Coursera Capstone Projects - The Battle of Neighborhoods

Child Care in Toronto

1. Introduction/Business Problem

The Approach I used to begin this Project is by searching through the web to takle major issues facing residence of Toronto, especially families which having working parents. As I research through this problem, The Canadian daycare market has a well-established surplus of demand, resulting in anxiety-inducing waitlists — joined as early as the day a couple learns they’re expecting — and monthly fees that can amount to more than a mortgage payment. “It’s worse than finding a house or looking for an apartment.

A. Daycare fees continue to rise across Canada

In the study, child care is divided into three categories – infant, toddler,preschooler, Kindergarten, and Gradelevel. The researchers define these categories as birth to two years for infants, 18 months to three years for toddlers, and two-and-a-half years to kindergarten age for preschoolers, which is age four or five, depending on the province.

These categories often see wildly different prices for full-time care, as a result of the smaller number of facilities available for infants, as well as the higher ratio of caregivers to children required by law. This means that while preschool age child care tends to be a lower figure overall, it gives the best idea of what the average family pays, since half of children in child care centres in Canada fall into this category.

B. The waitlist problem

But costs can be only half the battle for families when it comes to child care. The demand for child care greatly surpasses availability in most cases.

Researchers found that in almost three-quarters of the cities covered in the study, centres maintained lengthy waitlists of children waiting to enter care programs. Bigger cities see 80 to 90 per cent of centres maintaining a waitlist, while even smaller cities like St. John’s are in the 79 per cent range.

Wait lists are one of the major hurdles keeping parents from accessing quality child care, with families having to start the process early if they want to get their child enrolled. “You have to apply basically while you’re pregnant !!!

Source: https://www.ctvnews.ca/features/analysis-daycare-fees-continue-to-rise-across-canada-1.3940099

2. Approach to Solve The Issue

  1. Help Individual (Parents) to find best Daycare Center for their child that match thier criteria.

  2. Encourage Business owners to invest in such high demand business by leveraging them with the best location.

  3. Benefits of growth of this business can be highly apprecaited by individuals and business owners. some are listed below:

    A. by relieving parents from lengthy wait list.

    B. cost reduction.

    C. Good investment for Business owners as the subject is in High demand.

3. Description of the data

I. Data Collection

  1. Licensed Day Care Centres (https://github.com/mkorogluNYC/NYC_Data_ScienceAcademy/blob/master/Shiny_project/toronto_cc.csv#L1008)
  2. The venues in each neighborhood. (FourSquare API)
  3. Postal codes in Toronto (https://en.wikipedia.org/wiki/List_of_postal_codes_of_Canada:_M)
  4. Toronto geospatial data (https://cocl.us/Geospatial_data)
In [1]:
%matplotlib inline
import numpy as np # library to handle data in a vectorized manner
from bs4 import BeautifulSoup
import geocoder # import geocoder
import pandas as pd # library for data analsysis
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)

import json # library to handle JSON files
import random
import requests # library to handle requests
from pandas.io.json import json_normalize # tranform JSON file into a pandas dataframe

# Matplotlib and associated plotting modules
import matplotlib.cm as cm
import matplotlib.colors as colors

# import k-means from clustering stage
from sklearn.cluster import KMeans
from sklearn import preprocessing
from sklearn.datasets.samples_generator import make_blobs
import folium # map rendering library

print('Libraries imported.')
Libraries imported.

II. Data Importing

In [2]:
#reading table from wikipedia page
Toronto_df = pd.read_html("https://en.wikipedia.org/wiki/List_of_postal_codes_of_Canada:_M", header=0,
            attrs={"class":"wikitable sortable"})[0]
Toronto_df.head()
Out[2]:
Postcode Borough Neighbourhood
0 M1A Not assigned Not assigned
1 M2A Not assigned Not assigned
2 M3A North York Parkwoods
3 M4A North York Victoria Village
4 M5A Downtown Toronto Harbourfront
In [3]:
#lets drop Borough that has cells with 'Not assigned' values
Not_assigned = Toronto_df[Toronto_df['Borough'] == 'Not assigned'].index
    
# Delete these row indexes from dataFrame
Toronto_df.drop(Not_assigned , inplace=True)
Toronto_df.head()
Out[3]:
Postcode Borough Neighbourhood
2 M3A North York Parkwoods
3 M4A North York Victoria Village
4 M5A Downtown Toronto Harbourfront
5 M5A Downtown Toronto Regent Park
6 M6A North York Lawrence Heights
In [4]:
#lets change cells that are having 'Not assigned' values in Neighborhood coloumn to match its corresponding Borough index
Toronto_df.loc[Toronto_df['Neighbourhood'] == 'Not assigned', ['Neighbourhood']] = Toronto_df['Borough']
Toronto_df.head()
Out[4]:
Postcode Borough Neighbourhood
2 M3A North York Parkwoods
3 M4A North York Victoria Village
4 M5A Downtown Toronto Harbourfront
5 M5A Downtown Toronto Regent Park
6 M6A North York Lawrence Heights
In [5]:
#lets group Neighborhoods having the same postalcode
Toronto_df = Toronto_df.groupby(['Postcode','Borough'])['Neighbourhood'].apply(', '.join).reset_index()
Toronto_df.head()
Out[5]:
Postcode Borough Neighbourhood
0 M1B Scarborough Rouge, Malvern
1 M1C Scarborough Highland Creek, Rouge Hill, Port Union
2 M1E Scarborough Guildwood, Morningside, West Hill
3 M1G Scarborough Woburn
4 M1H Scarborough Cedarbrae
In [6]:
Toronto_df.rename_axis("Postal Code", axis='index', inplace=True)
Toronto_df.head()
Out[6]:
Postcode Borough Neighbourhood
Postal Code
0 M1B Scarborough Rouge, Malvern
1 M1C Scarborough Highland Creek, Rouge Hill, Port Union
2 M1E Scarborough Guildwood, Morningside, West Hill
3 M1G Scarborough Woburn
4 M1H Scarborough Cedarbrae
In [7]:
# lets now import all Licensed child care centers in Toronto
child_center = pd.read_html('https://github.com/mkorogluNYC/NYC_Data_ScienceAcademy/blob/master/Shiny_project/toronto_cc.csv#L1008',header=0)[0]
child_center.head()
Out[7]:
Unnamed: 0 Unnamed: 1 loc_id name type str_no street postal_code ward phone building.type bldgname Infant Toddler Preschooler Kindergarten Gradelevel Total subsidy gc_geoid longitude latitude run_date district
0 NaN 1 1013 Lakeshore Community Child Care Centre Non-Profit 101 seventh st M8V 3B5 6 416-394-7601 Public Elementary School Seventh Street Public School 0 20 32 40 60 152 Yes 1031242 -79.504631 43.599911 15-Jun-17 Etobicoke York
1 NaN 2 1014 Alternative Primary School Parent Group Non-Profit 1100 spadina rd M5N 2M6 16 416-322-5385 Public Elementary School North Preparatory Public School 0 0 12 26 45 83 Yes 870542 -79.420388 43.705491 15-Jun-17 North York
2 NaN 3 1015 Cardinal Leger Child Care Centre (Scarborough) Non-Profit 600 morrish rd M1C 4Y1 44 416-287-0578 Catholic Elementary School Cardinal Leger Catholic School 0 10 16 26 50 102 Yes 365821 -79.175711 43.793104 15-Jun-17 Scarborough
3 NaN 4 1016 George Brown - Richmond Adelaide Childcare Centre Non-Profit 130 adelaide st w M5H 3P5 28 416-415-2453 Other NaN 10 15 40 0 0 65 Yes 10222910 -79.383812 43.649691 15-Jun-17 Toronto East York
4 NaN 5 1017 Woodland Nursery School Non-Profit 1 firvalley crt M1L 1N8 35 416-694-1138x151 High Rise Apartment NaN 0 10 0 0 0 10 No 334543 -79.281029 43.702952 15-Jun-17 Scarborough

III. Data Cleaning & Processing

In [8]:
# lets see how many child care centers in Toronto
child_center.shape
Out[8]:
(1007, 24)
In [9]:
#lets examine total number of childern enrolled on those centers
child_center['Total'].sum()
Out[9]:
68763
In [10]:
child_center.drop(['Unnamed: 0', 'Unnamed: 1'], axis=1, inplace=True)
child_center.rename(columns={'district':'Borough'}, inplace=True)
child_center.head(5)
Out[10]:
loc_id name type str_no street postal_code ward phone building.type bldgname Infant Toddler Preschooler Kindergarten Gradelevel Total subsidy gc_geoid longitude latitude run_date Borough
0 1013 Lakeshore Community Child Care Centre Non-Profit 101 seventh st M8V 3B5 6 416-394-7601 Public Elementary School Seventh Street Public School 0 20 32 40 60 152 Yes 1031242 -79.504631 43.599911 15-Jun-17 Etobicoke York
1 1014 Alternative Primary School Parent Group Non-Profit 1100 spadina rd M5N 2M6 16 416-322-5385 Public Elementary School North Preparatory Public School 0 0 12 26 45 83 Yes 870542 -79.420388 43.705491 15-Jun-17 North York
2 1015 Cardinal Leger Child Care Centre (Scarborough) Non-Profit 600 morrish rd M1C 4Y1 44 416-287-0578 Catholic Elementary School Cardinal Leger Catholic School 0 10 16 26 50 102 Yes 365821 -79.175711 43.793104 15-Jun-17 Scarborough
3 1016 George Brown - Richmond Adelaide Childcare Centre Non-Profit 130 adelaide st w M5H 3P5 28 416-415-2453 Other NaN 10 15 40 0 0 65 Yes 10222910 -79.383812 43.649691 15-Jun-17 Toronto East York
4 1017 Woodland Nursery School Non-Profit 1 firvalley crt M1L 1N8 35 416-694-1138x151 High Rise Apartment NaN 0 10 0 0 0 10 No 334543 -79.281029 43.702952 15-Jun-17 Scarborough

4. Methodology

Child care cost is one of the key component of expenses of a family. It becomes more crucial for families, where each parent is not available to take care of their child and cannot afford to pay the full amount of the child care tuition. Child care fee subsidy in Canada is the main child care financing of each province introduced in the Canada Assistance Plan in 1972. Eligible families pay the child care cost depending on the income level. Certain conditions in terms of unavailability of each parent are listed in City of Toronto's website as the following.

Each parent is either:

  • employed,
  • looking for work,
  • in school or planning to go to school, or
  • if their child has a special need.

Eligible income range for child care fee subsidy in the City of Toronto is up to $73,000. Families with lower income ranges are eligible for larger amount of fee subsidy. This project aims to visualize the effectiveness of child care fee subsidy using dataset from the City of Toronto open data catalogue. The project has three purposes. First, the user can find the child care centre depending on his or her preferences on the location, subsidy choice, and the type of child care centre. Second, child care centres can be listed through the data clustering map, where the user can filter the results based on the location, subsidy, and type of child care centre choice. Finally, key insights from the dataset are provided to make the decision on how effective the fee subsidy program in the City of Toronto is at policy level.

5. Analysis

In [11]:
subsidy_center = child_center['subsidy'].value_counts() 
subsidy_center = child_center.groupby(['name', 'subsidy','type','Borough'], as_index = False).sum()
subsidy_center.head(5)
Out[11]:
name subsidy type Borough loc_id ward Infant Toddler Preschooler Kindergarten Gradelevel Total gc_geoid longitude latitude
0 A & A Child Care Centre Yes Non-Profit Scarborough 1288 41 20 25 48 0 45 138 2834434 -79.290347 43.809303
1 A B C Day Nursery Yes Commercial North York 1036 15 10 15 16 20 25 86 67882 -79.441030 43.703263
2 A Place To Play Nursery School Of Bloor West V... No Non-Profit Etobicoke York 6632 13 0 0 16 0 0 16 7985487 -79.485018 43.659347
3 Abacus Day Care Centre (629735 Ontario Inc.) Yes Commercial Scarborough 1301 40 0 10 24 0 0 34 319578 -79.321767 43.777312
4 Abacus Montessori Learning Centre No Commercial North York 9995 34 0 15 48 0 0 63 504128 -79.317554 43.724980
In [12]:
#lets see how many centers provide fee_subsidy in Toronto
subsidy_center = child_center['subsidy'].value_counts()
subsidy_center.rename(columns={'subsidy':'fee_subsidy'},inplace = True)
subsidy_center.index.name = 'fee_subsidy'
subsidy_center
Out[12]:
fee_subsidy
Yes    677
No     330
dtype: int64
In [13]:
child_center.describe()
Out[13]:
loc_id ward Infant Toddler Preschooler Kindergarten Gradelevel Total gc_geoid longitude latitude
count 1007.000000 1007.000000 1007.000000 1007.000000 1007.000000 1007.000000 1007.000000 1007.000000 1.007000e+03 1007.000000 1007.000000
mean 6878.050645 22.650447 3.464747 9.788481 22.910626 12.385303 19.735849 68.285005 6.099534e+06 -79.391608 43.710181
std 4719.244161 12.133328 5.967315 9.937576 17.022788 17.797639 26.052053 41.821418 6.010884e+06 0.099926 0.052627
min 1013.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 8.000000 1.759900e+04 -79.619182 43.594338
25% 1775.500000 13.000000 0.000000 0.000000 16.000000 0.000000 0.000000 39.000000 5.759305e+05 -79.466426 43.666744
50% 6551.000000 23.000000 0.000000 10.000000 24.000000 0.000000 0.000000 57.000000 6.355204e+06 -79.392675 43.702515
75% 12064.000000 32.000000 10.000000 15.000000 32.000000 26.000000 30.000000 88.000000 9.538058e+06 -79.321176 43.752525
max 13564.000000 44.000000 30.000000 56.000000 204.000000 100.000000 144.000000 280.000000 3.007298e+07 -79.137419 43.830572
In [14]:
#lets see how many categories of child care centers and how many center in each category 
center_type = child_center['type'].value_counts()
center_type.rename(columns={'type':'center_type'},inplace = True)
center_type.index.name = 'center_type'
center_type
Out[14]:
center_type
Non-Profit       668
Commercial       286
City-Operated     53
dtype: int64

According to our data for the Liscensed child care center in Toronto, we found that:

  • Non-Profit centers = 668
  • Commercial Centers = 286
  • City operated centers = 53
In [15]:
import matplotlib.pyplot as plt
ax = center_type.plot(kind='bar',figsize=(15, 8),width = 0.4,color = ['#5cb85c','#5bc0de','#d9534f'],edgecolor=None)
plt.title("No. of Child Care Centers in each Category in Toronto",fontsize= 16)
plt.xticks(fontsize=14)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
plt.yticks([])
# Add this loop to add the annotations 
for p in ax.patches:
    width, height = p.get_width(), p.get_height()
    x, y = p.get_xy() 
    ax.annotate("{:}".format(height), (p.get_x()+ .45*width, p.get_y() + height + 4) ,fontsize= 14)
In [16]:
#lets see how many child care centers in each Borough
center_loc = child_center['Borough'].value_counts()
center_loc.index.name = 'Borough'
center_loc
Out[16]:
Borough
Toronto East York    318
North York           266
Etobicoke York       226
Scarborough          197
Name: Borough, dtype: int64

According to our data for the Liscensed child care center in Toronto again, we found that:

  • child care centers in Toronto East York = 318
  • child care centers in North York = 266
  • child care centers in Etobicoke York = 226
  • child care centers in Scarborough = 197
In [17]:
ax1 = center_loc.plot(kind='bar',figsize=(15, 8),width = 0.4 ,edgecolor=None)
plt.title("No. of Child Care Centers in Each Borough",fontsize= 16)

plt.xticks(fontsize=14)
ax1.spines['top'].set_visible(False)
ax1.spines['right'].set_visible(False)
ax1.spines['left'].set_visible(False)
plt.yticks([])
# Add this loop to add the annotations 
for p in ax1.patches:
    width, height = p.get_width(), p.get_height()
    x, y = p.get_xy() 
    ax1.annotate("{:}".format(height), (p.get_x()+ .45*width, p.get_y() + height + 4) ,fontsize= 14)
In [18]:
# lets see child distribution among each categories in each Bourough
df_test = child_center[['type','Borough', 'subsidy','Infant','Toddler','Preschooler','Kindergarten','Gradelevel','Total']]
df_grp = df_test.groupby(['Borough','subsidy', 'type'], as_index = False).sum()
df_grp.head()
Out[18]:
Borough subsidy type Infant Toddler Preschooler Kindergarten Gradelevel Total
0 Etobicoke York No Commercial 165 539 1327 209 402 2642
1 Etobicoke York No Non-Profit 20 109 556 15 208 908
2 Etobicoke York Yes City-Operated 126 205 312 62 74 779
3 Etobicoke York Yes Commercial 116 275 633 248 459 1731
4 Etobicoke York Yes Non-Profit 306 770 1562 2334 3909 8881
In [20]:
df_grp1 = df_grp.groupby(['type','subsidy','Borough'])['Total'].sum(normalize=True)
df_grp1
Out[20]:
type           subsidy  Borough          
City-Operated  Yes      Etobicoke York         779
                        North York             471
                        Scarborough            597
                        Toronto East York      815
Commercial     No       Etobicoke York        2642
                        North York            2866
                        Scarborough           1009
                        Toronto East York     3652
               Yes      Etobicoke York        1731
                        North York            2218
                        Scarborough           2559
                        Toronto East York      553
Non-Profit     No       Etobicoke York         908
                        North York            1995
                        Scarborough            933
                        Toronto East York     2004
               Yes      Etobicoke York        8881
                        North York           11795
                        Scarborough           6644
                        Toronto East York    15711
Name: Total, dtype: int64
From above dataframe, we noticed that all city operated centers are eligible for fee subsidy. In contrast, commercial & Non-profit centers are eligible for both. Now, lets visualize number of children enrolled in each categories in each Borough
In [28]:
df_grp1.plot(kind='barh', figsize=(25, 20), color='steelblue', edgecolor=None, fontsize= 20)
plt.xlabel('Number of enrolled children',fontsize= 16)
plt.title('Child Distribution Among Each Categories in each Bourough',fontsize= 20)

for index, value in enumerate(df_grp1): 
    label = format(int(value), ',') 
    plt.annotate(label, xy=(value - 4, index - 0.10), color='black',fontsize= 20)
plt.show()
In [29]:
df_test1 = child_center[['type','Borough', 'subsidy','Infant','Toddler','Preschooler','Kindergarten','Gradelevel','Total']]
#df_test
df_grp2 = df_test.groupby(['Borough', 'type'], as_index = False).sum()
df_grp2
Out[29]:
Borough type Infant Toddler Preschooler Kindergarten Gradelevel Total
0 Etobicoke York City-Operated 126 205 312 62 74 779
1 Etobicoke York Commercial 281 814 1960 457 861 4373
2 Etobicoke York Non-Profit 326 879 2118 2349 4117 9789
3 North York City-Operated 46 75 152 80 118 471
4 North York Commercial 371 1206 2646 305 556 5084
5 North York Non-Profit 422 1588 4034 2895 4851 13790
6 Scarborough City-Operated 76 145 224 98 54 597
7 Scarborough Commercial 251 658 1669 227 763 3568
8 Scarborough Non-Profit 371 938 2118 1644 2506 7577
9 Toronto East York City-Operated 110 180 280 100 145 815
10 Toronto East York Commercial 434 1074 2226 272 199 4205
11 Toronto East York Non-Profit 675 2095 5332 3983 5630 17715
In [30]:
df_grp2.columns.values 
Out[30]:
array(['Borough', 'type', 'Infant', 'Toddler', 'Preschooler',
       'Kindergarten', 'Gradelevel', 'Total'], dtype=object)
In [31]:
df_grp2.index.values
Out[31]:
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11], dtype=int64)
In [32]:
print(type(df_grp2.columns))
print(type(df_grp2.index))
<class 'pandas.core.indexes.base.Index'>
<class 'pandas.core.indexes.numeric.Int64Index'>
In [33]:
df_grp2.columns.tolist()
df_grp2.index.tolist()

print (type(df_grp2.columns.tolist()))
print (type(df_grp2.index.tolist()))
<class 'list'>
<class 'list'>
In [34]:
df_grp2.type # returns a series
Out[34]:
0     City-Operated
1        Commercial
2        Non-Profit
3     City-Operated
4        Commercial
5        Non-Profit
6     City-Operated
7        Commercial
8        Non-Profit
9     City-Operated
10       Commercial
11       Non-Profit
Name: type, dtype: object
In [35]:
df_grp2.set_index('type', inplace=True)
df_grp2
Out[35]:
Borough Infant Toddler Preschooler Kindergarten Gradelevel Total
type
City-Operated Etobicoke York 126 205 312 62 74 779
Commercial Etobicoke York 281 814 1960 457 861 4373
Non-Profit Etobicoke York 326 879 2118 2349 4117 9789
City-Operated North York 46 75 152 80 118 471
Commercial North York 371 1206 2646 305 556 5084
Non-Profit North York 422 1588 4034 2895 4851 13790
City-Operated Scarborough 76 145 224 98 54 597
Commercial Scarborough 251 658 1669 227 763 3568
Non-Profit Scarborough 371 938 2118 1644 2506 7577
City-Operated Toronto East York 110 180 280 100 145 815
Commercial Toronto East York 434 1074 2226 272 199 4205
Non-Profit Toronto East York 675 2095 5332 3983 5630 17715

city operated centers

lets see what is the total number of children in city_operated centers in Toronto

In [36]:
# city operated centers
city_op = df_grp2.loc['City-Operated', ['Borough','Infant', 'Toddler', 'Preschooler', 'Kindergarten', 'Gradelevel', 'Total']]
city_op.set_index('Borough', inplace=True)
city_op
Out[36]:
Infant Toddler Preschooler Kindergarten Gradelevel Total
Borough
Etobicoke York 126 205 312 62 74 779
North York 46 75 152 80 118 471
Scarborough 76 145 224 98 54 597
Toronto East York 110 180 280 100 145 815
In [37]:
# lets see what is the total number of children in city_operated centers in Toronto
child_num = city_op['Total'].sum()
child_num
Out[37]:
2662
In [45]:
ax4 = city_op.plot(kind='bar',figsize=(20, 10),width = 0.8,edgecolor=None)
plt.legend(city_op.columns,fontsize= 14)
plt.title("Distribution of children by Age enrolled in City_Operated centers in each Borough ",fontsize= 16)

plt.xticks(fontsize=14)
ax4.spines['top'].set_visible(False)
ax4.spines['right'].set_visible(False)
ax4.spines['left'].set_visible(False)
plt.yticks([])
# Add this loop to add the annotations 
for p in ax4.patches:
    width, height = p.get_width(), p.get_height()
    x, y = p.get_xy() 
    ax4.annotate("{:}".format(height), (p.get_x()+.057 *width, p.get_y() + height + 2) ,fontsize= 13)

Commercial centers

lets see what is the total number of children in Commercial centers in Toronto

In [40]:
Commer_cent = df_grp2.loc['Commercial', ['Borough','Infant',  'Toddler', 'Preschooler', 'Kindergarten', 'Gradelevel', 'Total']]
Commer_cent.set_index('Borough', inplace=True)
Commer_cent
Out[40]:
Infant Toddler Preschooler Kindergarten Gradelevel Total
Borough
Etobicoke York 281 814 1960 457 861 4373
North York 371 1206 2646 305 556 5084
Scarborough 251 658 1669 227 763 3568
Toronto East York 434 1074 2226 272 199 4205
In [41]:
# lets see what is the total number of children in commercial centers in Toronto
child_num1 = Commer_cent['Total'].sum()
child_num1
Out[41]:
17230
In [44]:
ax5 = Commer_cent.plot(kind='bar',figsize=(20, 10),width = 0.8,edgecolor=None)
plt.legend(Commer_cent.columns,fontsize= 14)
plt.title("Distribution of children by Age enrolled in Commercial centers in each Borough ",fontsize= 16)

plt.xticks(fontsize=14)
ax5.spines['top'].set_visible(False)
ax5.spines['right'].set_visible(False)
ax5.spines['left'].set_visible(False)
plt.yticks([])
# Add this loop to add the annotations 
for p in ax5.patches:
    width, height = p.get_width(), p.get_height()
    x, y = p.get_xy() 
    ax5.annotate("{:}".format(height), (p.get_x()+.059 *width, p.get_y() + height + 3) ,fontsize= 14)

Non-profit centers

lets see what is the total number of children in Non-profit centers in Toronto

In [46]:
non_profit = df_grp2.loc['Non-Profit', ['Borough','Infant', 'Toddler', 'Preschooler', 'Kindergarten', 'Gradelevel', 'Total']]
non_profit.set_index('Borough', inplace=True)
non_profit
Out[46]:
Infant Toddler Preschooler Kindergarten Gradelevel Total
Borough
Etobicoke York 326 879 2118 2349 4117 9789
North York 422 1588 4034 2895 4851 13790
Scarborough 371 938 2118 1644 2506 7577
Toronto East York 675 2095 5332 3983 5630 17715
In [47]:
# lets see what is the total number of children in Non-Profit centers in Toronto
child_num2 = non_profit['Total'].sum()
child_num2
Out[47]:
48871
In [48]:
ax6 = non_profit.plot(kind='bar',figsize=(20, 10),width = 0.8,edgecolor=None)
plt.legend(non_profit.columns,fontsize= 14)
plt.title("Distribution of children by Age enrolled in Non_Profit Centers in each Borough ",fontsize= 16)

plt.xticks(fontsize=14)
ax6.spines['top'].set_visible(False)
ax6.spines['right'].set_visible(False)
ax6.spines['left'].set_visible(False)
plt.yticks([])
# Add this loop to add the annotations 
for p in ax6.patches:
    width, height = p.get_width(), p.get_height()
    x, y = p.get_xy() 
    ax6.annotate("{:}".format(height), (p.get_x()+.006 *width, p.get_y() + height + 7) ,fontsize= 14)
In [49]:
print('Percentage of child enrolled in Non-profit centers = {:}%'.format(child_num2/68763* 100))
print('Percentage of child enrolled in Commercial centers = {:}%'.format(child_num1/68763* 100))
print('Percentage of child enrolled in City-Operated centers = {:}%'.format(child_num/68763* 100))
Percentage of child enrolled in Non-profit centers = 71.07165190582144%
Percentage of child enrolled in Commercial centers = 25.057080115759927%
Percentage of child enrolled in City-Operated centers = 3.8712679784186266%
In [51]:
child_center.columns = list(map(str, child_center.columns))
child_center.head()
Out[51]:
loc_id name type str_no street postal_code ward phone building.type bldgname Infant Toddler Preschooler Kindergarten Gradelevel Total subsidy gc_geoid longitude latitude run_date Borough
0 1013 Lakeshore Community Child Care Centre Non-Profit 101 seventh st M8V 3B5 6 416-394-7601 Public Elementary School Seventh Street Public School 0 20 32 40 60 152 Yes 1031242 -79.504631 43.599911 15-Jun-17 Etobicoke York
1 1014 Alternative Primary School Parent Group Non-Profit 1100 spadina rd M5N 2M6 16 416-322-5385 Public Elementary School North Preparatory Public School 0 0 12 26 45 83 Yes 870542 -79.420388 43.705491 15-Jun-17 North York
2 1015 Cardinal Leger Child Care Centre (Scarborough) Non-Profit 600 morrish rd M1C 4Y1 44 416-287-0578 Catholic Elementary School Cardinal Leger Catholic School 0 10 16 26 50 102 Yes 365821 -79.175711 43.793104 15-Jun-17 Scarborough
3 1016 George Brown - Richmond Adelaide Childcare Centre Non-Profit 130 adelaide st w M5H 3P5 28 416-415-2453 Other NaN 10 15 40 0 0 65 Yes 10222910 -79.383812 43.649691 15-Jun-17 Toronto East York
4 1017 Woodland Nursery School Non-Profit 1 firvalley crt M1L 1N8 35 416-694-1138x151 High Rise Apartment NaN 0 10 0 0 0 10 No 334543 -79.281029 43.702952 15-Jun-17 Scarborough

Exploring and clustering neighborhoods in Toronto.

In [52]:
#!conda install -c conda-forge geopy --yes
from geopy.geocoders import Nominatim # convert an address into latitude and longitude values
In [53]:
#!conda install -c conda-forge folium=0.5.0 --yes
import folium

print('Folium installed and imported!')
Folium installed and imported!
In [54]:
# Use geopy library to get the latitude and longitude values of Toronto
address = 'Toronto, Ontario Canada'

geolocator = Nominatim()
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude
print('The geograpical coordinate of Toronto Canada are {}, {}.'.format(latitude, longitude))
C:\Users\adnan-\Anaconda3\lib\site-packages\ipykernel_launcher.py:4: DeprecationWarning: Using Nominatim with the default "geopy/1.19.0" `user_agent` is strongly discouraged, as it violates Nominatim's ToS https://operations.osmfoundation.org/policies/nominatim/ and may possibly cause 403 and 429 HTTP errors. Please specify a custom `user_agent` with `Nominatim(user_agent="my-application")` or by overriding the default `user_agent`: `geopy.geocoders.options.default_user_agent = "my-application"`. In geopy 2.0 this will become an exception.
  after removing the cwd from sys.path.
The geograpical coordinate of Toronto Canada are 43.653963, -79.387207.
In [55]:
# create map of Toronto using latitude and longitude values
toronto_map = folium.Map(location=[latitude, longitude], zoom_start=11)

# add markers to map
for lat, lng, name, type, Borough in zip(child_center['latitude'], child_center['longitude'], child_center['name'], 
    child_center['type'] , child_center['Borough'] ):
    label = '{},{},{}'.format(name,type,Borough)
    label = folium.Popup(label, parse_html=True)
    folium.CircleMarker(
        [lat, lng],
        radius=4,
        popup=label,
        color='blue',
        fill=True,
        fill_color='#87cefa',
        fill_opacity=0.5,
        parse_html=False).add_to(toronto_map)
    
In [56]:
toronto_map
Out[56]:

Using the Foursquare API to explore and segmented neighborhoods

In [100]:
# Credentials to be Omitted!!!
In [58]:
# lets explore first child care center in our dataframe
child_center.loc[0]
Out[58]:
loc_id                                            1013
name             Lakeshore Community Child Care Centre
type                                        Non-Profit
str_no                                             101
street                                      seventh st
postal_code                                    M8V 3B5
ward                                                 6
phone                                     416-394-7601
building.type                 Public Elementary School
bldgname                  Seventh Street Public School
Infant                                               0
Toddler                                             20
Preschooler                                         32
Kindergarten                                        40
Gradelevel                                          60
Total                                              152
subsidy                                            Yes
gc_geoid                                       1031242
longitude                                     -79.5046
latitude                                       43.5999
run_date                                     15-Jun-17
Borough                                 Etobicoke York
Name: 0, dtype: object
In [59]:
# Get the child care center's latitude and longitude values.
childcare_center_latitude = child_center.loc[0, 'latitude'] # Center latitude value
childcare_center_longitude = child_center.loc[0, 'longitude'] # Center longitude value
childcare_center_name = child_center.loc[0, 'name'] # Center name
childcare_center_loc = child_center.loc[0, 'Borough']# Borough name
childcare_center_type = child_center.loc[0, 'type']# Center type
print('Latitude and longitude values of {} are {}, {}.'.format(childcare_center_name, 
                                                               childcare_center_latitude, 
                                                               childcare_center_longitude))
print('This child care center is in {} and it is {}.'.format(childcare_center_loc,childcare_center_type))
Latitude and longitude values of Lakeshore Community Child Care Centre are 43.59991069, -79.50463054.
This child care center is in Etobicoke York and it is Non-Profit.
In [60]:
toronto_onehot = pd.get_dummies(child_center[['subsidy','type']], prefix="", prefix_sep="")

# add care center column back to dataframe
toronto_onehot['name'] = child_center['name'] 

# move care center column to the first column
fixed_columns = [toronto_onehot.columns[-1]] + list(toronto_onehot.columns[:-1])
toronto_onehot = toronto_onehot[fixed_columns]

toronto_onehot.head()
Out[60]:
name No Yes City-Operated Commercial Non-Profit
0 Lakeshore Community Child Care Centre 0 1 0 0 1
1 Alternative Primary School Parent Group 0 1 0 0 1
2 Cardinal Leger Child Care Centre (Scarborough) 0 1 0 0 1
3 George Brown - Richmond Adelaide Childcare Centre 0 1 0 0 1
4 Woodland Nursery School 1 0 0 0 1
In [61]:
toronto_onehot.shape
Out[61]:
(1007, 6)

Clustering Neighborhoods

Run k-means to cluster the neighborhood into 5 clusters.

In [62]:
kclusters = 5

toronto_grouped_clustering = toronto_onehot.drop('name', 1)
# run k-means clustering
kmeans = KMeans(n_clusters=kclusters, random_state=1).fit(toronto_grouped_clustering)

# check cluster labels generated for each row in the dataframe
kmeans.labels_[0:5]
Out[62]:
array([1, 1, 1, 1, 3])
In [63]:
toronto_merged = child_center 

# add clustering labels
toronto_merged['Cluster Labels'] = kmeans.labels_

# merge toronto_grouped with toronto_data to add latitude/longitude for each neighborhood
toronto_merged = toronto_merged.join(toronto_onehot.set_index('name'), on='name')

toronto_merged.head() # check the last columns!
Out[63]:
loc_id name type str_no street postal_code ward phone building.type bldgname Infant Toddler Preschooler Kindergarten Gradelevel Total subsidy gc_geoid longitude latitude run_date Borough Cluster Labels No Yes City-Operated Commercial Non-Profit
0 1013 Lakeshore Community Child Care Centre Non-Profit 101 seventh st M8V 3B5 6 416-394-7601 Public Elementary School Seventh Street Public School 0 20 32 40 60 152 Yes 1031242 -79.504631 43.599911 15-Jun-17 Etobicoke York 1 0 1 0 0 1
1 1014 Alternative Primary School Parent Group Non-Profit 1100 spadina rd M5N 2M6 16 416-322-5385 Public Elementary School North Preparatory Public School 0 0 12 26 45 83 Yes 870542 -79.420388 43.705491 15-Jun-17 North York 1 0 1 0 0 1
2 1015 Cardinal Leger Child Care Centre (Scarborough) Non-Profit 600 morrish rd M1C 4Y1 44 416-287-0578 Catholic Elementary School Cardinal Leger Catholic School 0 10 16 26 50 102 Yes 365821 -79.175711 43.793104 15-Jun-17 Scarborough 1 0 1 0 0 1
3 1016 George Brown - Richmond Adelaide Childcare Centre Non-Profit 130 adelaide st w M5H 3P5 28 416-415-2453 Other NaN 10 15 40 0 0 65 Yes 10222910 -79.383812 43.649691 15-Jun-17 Toronto East York 1 0 1 0 0 1
4 1017 Woodland Nursery School Non-Profit 1 firvalley crt M1L 1N8 35 416-694-1138x151 High Rise Apartment NaN 0 10 0 0 0 10 No 334543 -79.281029 43.702952 15-Jun-17 Scarborough 3 1 0 0 0 1
In [64]:
toronto_merged.groupby('Cluster Labels').mean()
Out[64]:
loc_id ward Infant Toddler Preschooler Kindergarten Gradelevel Total gc_geoid longitude latitude No Yes City-Operated Commercial Non-Profit
Cluster Labels
0 3634.436170 24.425532 6.585106 14.776596 30.457447 6.510638 16.787234 75.117021 6.113415e+06 -79.372614 43.733530 0.0 1.0 0.0 1.000000 0.000000
1 5619.293233 22.939850 3.240602 8.624060 19.552632 19.746241 30.009398 81.172932 5.761008e+06 -79.391281 43.710553 0.0 1.0 0.0 0.000000 1.000000
2 10873.601036 22.222798 3.720207 12.321244 29.419689 3.362694 4.150259 52.974093 6.456575e+06 -79.393549 43.702253 1.0 0.0 0.0 0.994819 0.005181
3 9816.553957 21.338129 0.503597 6.705036 23.482014 2.913669 8.618705 42.223022 6.400810e+06 -79.399636 43.704557 1.0 0.0 0.0 0.007194 0.992806
4 3204.660377 22.603774 6.754717 11.415094 18.264151 6.415094 7.377358 50.226415 7.565874e+06 -79.392709 43.712844 0.0 1.0 1.0 0.000000 0.000000
In [65]:
# create map
map_clusters = folium.Map(location=[latitude, longitude], zoom_start=11)

# set color scheme for the clusters
x = np.arange(kclusters)
ys = [i+x+(i*x)**2 for i in range(kclusters)]
colors_array = cm.rainbow(np.linspace(0, 1, len(ys)))
rainbow = [colors.rgb2hex(i) for i in colors_array]

# add markers to the map
markers_colors = []
for lat, lon, poi, cluster in zip(toronto_merged['latitude'], toronto_merged['longitude'], toronto_merged['name'],kmeans.labels_):
    label = folium.Popup(str(poi) + ' Cluster ' + str(cluster), parse_html=True)
    folium.CircleMarker(
        [lat, lon],
        radius=5,
        popup=label,
        color=rainbow[cluster-1],
        fill=True,
        fill_color=rainbow[cluster-1],
        fill_opacity=0.7).add_to(map_clusters)
       
map_clusters
Out[65]:
In [75]:
# Lets just take portion of dataframe where Boroughs is having least number of care centers (197) that is Scarborough.
toronto_scarborough = toronto_merged[toronto_merged['Borough'].str.contains("Scarborough")].reset_index(drop=True)
print(toronto_scarborough.shape)
toronto_scarborough.head()
(199, 28)
Out[75]:
loc_id name type str_no street postal_code ward phone building.type bldgname Infant Toddler Preschooler Kindergarten Gradelevel Total subsidy gc_geoid longitude latitude run_date Borough Cluster Labels No Yes City-Operated Commercial Non-Profit
0 1015 Cardinal Leger Child Care Centre (Scarborough) Non-Profit 600 morrish rd M1C 4Y1 44 416-287-0578 Catholic Elementary School Cardinal Leger Catholic School 0 10 16 26 50 102 Yes 365821 -79.175711 43.793104 15-Jun-17 Scarborough 1 0 1 0 0 1
1 1017 Woodland Nursery School Non-Profit 1 firvalley crt M1L 1N8 35 416-694-1138x151 High Rise Apartment NaN 0 10 0 0 0 10 No 334543 -79.281029 43.702952 15-Jun-17 Scarborough 3 1 0 0 0 1
2 1021 Centennial College Progress Campus Child Care ... Non-Profit 941 progress ave M1G 3T8 38 416-289-5000x2110 Community College/University Centennial College Of Applied Arts & Technology 10 20 16 0 0 46 Yes 13503978 -79.227030 43.785273 15-Jun-17 Scarborough 1 0 1 0 0 1
3 1031 Cedarbrae Day Nurseries (20 Greencrest) Commercial 20 greencrest circt M1G 1B8 43 416-431-2504 High Rise Apartment Greencrest Property 0 0 16 12 18 46 Yes 340155 -79.223431 43.758370 15-Jun-17 Scarborough 0 0 1 0 1 0
4 1045 Children's Village #1 Day Care Centre Commercial 1050 markham rd M1H 2Y7 38 416-438-3355 High Rise Apartment NaN 10 10 32 12 30 94 Yes 6576197 -79.231571 43.774373 15-Jun-17 Scarborough 0 0 1 0 1 0
In [76]:
# Re-create the map with new markers for scarborough Neighborhoods.
map_clusters = folium.Map(location=[latitude, longitude], zoom_start=11)

# set color scheme for the clusters
x = np.arange(kclusters)
ys = [i+x+(i*x)**2 for i in range(kclusters)]
colors_array = cm.rainbow(np.linspace(0, 1, len(ys)))
rainbow = [colors.rgb2hex(i) for i in colors_array]

# add markers to the map
markers_colors = []
for lat, lon, poi, cluster in zip(toronto_scarborough['latitude'], toronto_scarborough['longitude'], toronto_scarborough['name'],kmeans.labels_):
    label = folium.Popup(str(poi) + ' Cluster ' + str(cluster), parse_html=True)
    folium.CircleMarker(
        [lat, lon],
        radius=5,
        popup=label,
        color=rainbow[cluster-1],
        fill=True,
        fill_color=rainbow[cluster-1],
        fill_opacity=0.7).add_to(map_clusters)
       
map_clusters
Out[76]:

Now, let's use foursquare api query url, search child care center on all boroughs

In [77]:
# The following function retrieves the care center given the names and coordinates and stores it into dataframe.
LIMIT=100
def getNearbyCenters(names, latitudes, longitudes, radius=500):
    
    venues_list=[]
    for name, lat, lng in zip(names, latitudes, longitudes):
        print(name)
        # create the API request URL
        url = 'https://api.foursquare.com/v2/venues/explore?&client_id={}&client_secret={}&v={}&ll={},{}&radius={}&limit={}'.format(
            CLIENT_ID, 
            CLIENT_SECRET, 
            VERSION, 
            lat, 
            lng, 
            radius,
            LIMIT)
            
        # make the GET request
        results = requests.get(url).json()["response"]['groups'][0]['items']
        
        # return only relevant information for each nearby venue
        venues_list.append([(
            name, 
            lat, 
            lng, 
            v['venue']['name'], 
            v['venue']['location']['lat'], 
            v['venue']['location']['lng'],  
            v['venue']['categories'][0]['name']) for v in results])

    nearby_venues = pd.DataFrame([item for venue_list in venues_list for item in venue_list])
    nearby_venues.columns = ['care_center', 
                  'care_center Latitude', 
                  'care_center Longitude', 
                  'Venue', 
                  'Venue Latitude', 
                  'Venue Longitude', 
                  'Venue Category']
    
    return(nearby_venues)

Retrieve all centers and nearby venues given the Addresses

In [78]:
toronto_child_care = getNearbyCenters(names=toronto_scarborough['name'],
                                   latitudes=toronto_scarborough['latitude'],
                                   longitudes=toronto_scarborough['longitude']
                                  )
Cardinal Leger Child Care Centre (Scarborough)
Woodland Nursery School
Centennial College Progress Campus Child Care Centre(941 Progress)
Cedarbrae Day Nurseries (20 Greencrest)
Children's Village #1 Day Care Centre
Discovery Place Child Care Centre Ltd.
East Scarb. Boys' & Girls' Club(Eastside Child Care Centre 20 Waldock)
Eastside Club
Guildwood Child Care
Golf Road School Child Care Centre
Morningside Children's Centre
N.Y.A.D. Guildwood
N'Sheemaehn
Rosalie Hall Child Development Centre
Sandbox Day Care Centre
Sheppard Square Day Nursery
A & A Child Care Centre
West Hill Centre For Early Learning (Centres For Early Learning Inc.)
Abacus Day Care Centre (629735 Ontario Inc.)
Cedarbrae Day Nursery (1375 Midland)
Cedarbrae Day Nurseries (1385 Midland)
Children Of Tomorrow - John McCrae
Birchmount Place Centre For Early Learning
Immanuel Day Care Centre
Kiddies Lodge Day Care Centre
Kimbercroft Day Nursery (30 Kimbercroft Court)
Knob Hill Day Nursery
Kimbercroft Day Nursery 2
Progress Childcare (Scarborough Inc. #1 (3 Glamorgan)
Tamarack Day Care Centre (765566 Ontario Inc)
Mother Of Compassion Child Care
Vradenburg Community Child Care Centre
N.Y.A.D. Donwood
Wexford Community Childcare Centre
Rainbow Village Childcare Centre (Mid-Scarborough Child Care)
Cambridge Place Centre For Early Learning
Children's Village Day Care Centre #3
Cliffcrest Day Care Centre
Scarborough Village Day Nursery 1
Cougar Court Child Care Centre 25
Scarborough Village Day Nursery 2
Birds And Bees Day Care Centre
Hilltop Daycare Centre
Today's Child Tomorrow's Future Children's Centre (290 Blantyre)
John A. Leslie Childcare - Scarborough
Kenlinton Child Care Centre (Operator: Stonehill) Facility #16008
Kennedy Road Kiddy Kare
Today's Child Tomorrow's Future Children's Centre (725 Danforth)
Play Care Program/ West Scarborough Neighbourhood Com. Centre.
Berner Trail Early Learning & Child Care Centre
Bay Mills Early Learning & Child Care Centre
Lawrence Avenue East Early Learning & Child Care Centre
Gilder Early Learning & Child Care Centre
Warden Woods Satellite Early Learning & Child Care Centre
Galloway Early Learning & Child Care Centre
Warden Woods Early Learning & Child Care Centre
Canadiana Court Early Learning & Child Care Centre
Centenary Seven Oaks Early Learning & Child Care Centre
Cougar Court Child Care Centre 15
Lynngate Jr Ymca
Bridlewood Jr Ymca
Maryvale Jr Ymca
David Lewis Jr Ymca
Holy Spirit Jr Ymca
Pauline Johnson School Age Ymca
Glamorgan School Age Ymca
William G. Miller School Age Ymca
Knob Hill School Age Ymca
Hunter's Glen School Age Ymca
Brimwood School Age Ymca
Scarborough Jr Ymca
Morrish Jr Ymca
Lucy Maud Montgomery Jr Ymca
Timothy Eaton Infant & Toddler Centre
Isabella Walton Child Care
Fleming Jr Ymca
Nyad - Scarborough Village (15 Luella Street)
Mary Ward Child Care Centre
Rouge Valley Jr Ymca
St. Bede Child Care Centre
Port Royal Jr Ymca
N.Y.A.D. Corvette
N.Y.A.D. Progress
The Squirrel's Nest Child Care Centre
Garderie Chez Tante Laure
Garderie Chez Tante Laure
Malvern Early Learning & Child Care Centre
Guildwood Childcare Centre Satellite (Evans Corp 85 Livingstone)
Tic Toc Day Care Centre Inc
Growing Tykes Learning Centre 910
Gilder Satellite Early Learning & Child Care Centre
Scarborough Day Nursery School
Agincourt Montessori School Inc.
Agincourt Temple Day Care(Governing Council Of The Salvation Army)
Baylawn Co-Operative Preschool
Bridlegrove Daycare Centre
Beechgrove Sunshine Child Care
Fairmount Sunshine Child Care
Simcoe Sunshine Child Care
Mackie Sunshine Child Care Centre
Holland-Bloorview Kids Rehab. (Scarborough Site)
After Four Children's Enrichment Program
Banting And Best Child Care Centre
Charlottetown Blvd. Childcare Centre
Chartland Child Care Inc
Cheer Day Care Centre
Good Shepherd Day Care Centre
Meadowvale Daycare Centre
Port Union Panthers
St. Crispins Day Care Centre
Dearham Wood Daycare
Banting And Best Schoolage Satellite
Kids Love Day Care
Friendly Little Campus Daycare 2
Scarborough Citadel Child Care
Antrim Child Care
Future Stars Child Care Centre
Growing Tykes Learning Centre (4105 Lawrence Avenue East)
Avalon Children's Montessori School
Apple Day Care Centre
Birchmount Bluffs Neighbourhood Centre
N.Y.A.D. Midland
Garderie Mon Petit Jardin
Highland Creek Montessori Pre-School
Midland Child Care Centre
Angel Child Care Learning Centre (2042806 Ontario Inc.)
Broad View French Montessori School II Limited
Saint Nicholas Child Care Centre - Network
Denton Place Centre For Early Learning
Friendly Little Campus (2037711 Ontario Ltd)
Absorbent Minds
St. Sylvester Child Care Centre
The Divine Infant Child Care Centre
C.D.Farquharson Jr Ymca
Chester Le Early Learning & Child Care Centre
Epiphany Of Our Lord Jr Ymca
Sir Samuel B Steele Jr Ymca
St. Aidan Early Learning Centre Network
St. Boniface Jr Ymca
East Scarb. Child Care Centre(East Scarb. Boys & Girls Club
St. Rose Of Lima Ymca Child Care
Our Lady Of Grace Jr Ymca
Dian Childcare Centre Inc.
St. Gabriel Lalemant
Heritage Child Care & Early Learning Centre
Kreative Kids Child Care Centre
All My Children Child Care
Brookside Child Care Centre
Enjoy Learning Centre
Native Child & Family Life Centre - 156 Galloway
Big Bears Daycare
Gateway Montessori School
Jingbao Bilingual Children's Centre - Scarborough
Archway Montessori School
Better Beginnings Nursery School
Follow The Child
Heart Beatz Child Care - Solaris Site
Creative Minds Montessori Academy
Agape Christian Montessori School (2236800 Ontario Inc.)
Learning Jungle School - Kennedy Campus
Teach Me To Fly Preschool
Learn With Me Children Centre Inc.
Precious Blood Jr Ymca Elp
Smart Start Montessori School (1416786 Ontario Limited)
Kingston Road East Early Learning And Child Care Centre
N.Y.A.D. Cedar Drive
N.Y.A.D. Mason Road
Heritage Child Care & Early Learning - Milliken Site
Top Mandarin Day Care Centre
St. Maria Goretti - Network Childcare Services
St. Brendan Kindergarten Before & After School Program
William Tredway Jr. - Growing Tykes Learning Centre
Absorbent Minds 2
Centre Educatif A Petits Pas
Oakridge Junior Playcare
Kreative Kids Terry Fox
Beverly Glen Ymca
Heart Beatz - Halbert Child Care Site
Alvin Curling Ymca
Percy Williams Ymca
Plasp North Bridlewood Junior Public School
Plasp Inglewood Heights Junior Public School
Circles In The Sun Montessori Academy
Blaisdale Montessori School
Sunshine Montessori School - North York
Ellington Montessori School
Montessori Village Day Nursery
Mandarin Child Care Centre
Ellesmere Montessori School
Enquiring Minds Montessori
Blessed Pier Giorgio Frassati Extended Day Program
Wexford Extended Day And School Age Program
Children Of Tomorrow
Our Lady Of Fatima Ymca
Garderie Chez Tante Laure
Garderie Chez Tante Laure
Our Lady Of Wisdom Ymca
Nobi Montessori School & Daycare
Jacob Tree Preschool
In [79]:
# lets Check size of resulting dataframe
print(toronto_child_care.shape)
toronto_child_care.head()
(1777, 7)
Out[79]:
care_center care_center Latitude care_center Longitude Venue Venue Latitude Venue Longitude Venue Category
0 Cardinal Leger Child Care Centre (Scarborough) 43.793104 -79.175711 Highland Creek 43.790281 -79.173703 Neighborhood
1 Cardinal Leger Child Care Centre (Scarborough) 43.793104 -79.175711 Sunshine Variety & Video 43.794723 -79.174988 Convenience Store
2 Cardinal Leger Child Care Centre (Scarborough) 43.793104 -79.175711 Kraftsman Kabinets Inc. 43.793929 -79.179604 Home Service
3 Cardinal Leger Child Care Centre (Scarborough) 43.793104 -79.175711 Morrish Pharmacy 43.790225 -79.174382 Pharmacy
4 Woodland Nursery School 43.702952 -79.281029 Starbucks 43.703634 -79.277661 Coffee Shop
In [80]:
#Count of venues were returned for each Borough
toronto_child_care.groupby('care_center').count().head()
Out[80]:
care_center Latitude care_center Longitude Venue Venue Latitude Venue Longitude Venue Category
care_center
A & A Child Care Centre 19 19 19 19 19 19
Abacus Day Care Centre (629735 Ontario Inc.) 32 32 32 32 32 32
Absorbent Minds 15 15 15 15 15 15
Absorbent Minds 2 12 12 12 12 12 12
After Four Children's Enrichment Program 4 4 4 4 4 4
In [81]:
#lets see how many venues were returned by Foursquare?
print('There are {} uniques categories.'.format(len(toronto_child_care['Venue Category'].unique())))
There are 162 uniques categories.

Analyze Each Center

In [82]:
# one hot encoding
toronto_onehot = pd.get_dummies(toronto_child_care[['Venue Category']], prefix="", prefix_sep="")

# add neighborhood column back to dataframe
toronto_onehot['care_center'] = toronto_child_care['care_center'] 

# move neighborhood column to the first column
fixed_columns = [toronto_onehot.columns[-1]] + list(toronto_onehot.columns[:-1])
toronto_onehot = toronto_onehot[fixed_columns]

toronto_onehot.head()
Out[82]:
care_center African Restaurant American Restaurant Arts & Crafts Store Asian Restaurant Athletics & Sports Auto Dealership Auto Garage Automotive Shop BBQ Joint Badminton Court Bakery Bank Bar Baseball Field Beer Store Big Box Store Bistro Bookstore Bowling Alley Breakfast Spot Bubble Tea Shop Burger Joint Burrito Place Bus Line Bus Station Bus Stop Butcher Cafeteria Café Cajun / Creole Restaurant Camera Store Cantonese Restaurant Caribbean Restaurant Chinese Restaurant Clothing Store Coffee Shop College Stadium Construction & Landscaping Convenience Store Cosmetics Shop Deli / Bodega Department Store Dessert Shop Dim Sum Restaurant Diner Discount Store Dog Run Dumpling Restaurant Electronics Store Event Space Falafel Restaurant Fast Food Restaurant Filipino Restaurant Fish & Chips Shop Fish Market Flower Shop Food & Drink Shop Food Court Fried Chicken Joint Furniture / Home Store Garden Gas Station Gay Bar General Entertainment Gift Shop Golf Course Greek Restaurant Grocery Store Gym Gym / Fitness Center Gymnastics Gym Hakka Restaurant Harbor / Marina Hardware Store Hobby Shop Hockey Arena Home Service Hong Kong Restaurant Hookah Bar Hotel Hotpot Restaurant IT Services Ice Cream Shop Indian Restaurant Intersection Italian Restaurant Japanese Restaurant Jewelry Store Juice Bar Korean Restaurant Laundromat Light Rail Station Liquor Store Malay Restaurant Medical Center Mediterranean Restaurant Men's Store Metro Station Mexican Restaurant Middle Eastern Restaurant Miscellaneous Shop Mobile Phone Shop Movie Theater Moving Target Music Store Music Venue Nail Salon Neighborhood Noodle House North Indian Restaurant Optical Shop Paper / Office Supplies Store Park Pet Store Pharmacy Photography Studio Pizza Place Playground Pool Pool Hall Portuguese Restaurant Pub Rental Car Location Restaurant Road Salad Place Sandwich Place Sculpture Garden Seafood Restaurant Shoe Store Shop & Service Shopping Mall Skating Rink Smoke Shop Smoothie Shop Soccer Field Spa Sporting Goods Shop Sports Bar Sri Lankan Restaurant Steakhouse Storage Facility Supermarket Sushi Restaurant Taco Place Taiwanese Restaurant Tattoo Parlor Tea Room Tennis Court Thai Restaurant Theater Thrift / Vintage Store Toy / Game Store Trail Train Station Turkish Restaurant Vegetarian / Vegan Restaurant Video Game Store Vietnamese Restaurant Wings Joint Women's Store Yoga Studio
0 Cardinal Leger Child Care Centre (Scarborough) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 Cardinal Leger Child Care Centre (Scarborough) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 Cardinal Leger Child Care Centre (Scarborough) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 Cardinal Leger Child Care Centre (Scarborough) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 Woodland Nursery School 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In [83]:
toronto_onehot.shape
Out[83]:
(1777, 163)
In [84]:
toronto_grouped = toronto_onehot.groupby('care_center').mean().reset_index()
toronto_grouped.head()
Out[84]:
care_center African Restaurant American Restaurant Arts & Crafts Store Asian Restaurant Athletics & Sports Auto Dealership Auto Garage Automotive Shop BBQ Joint Badminton Court Bakery Bank Bar Baseball Field Beer Store Big Box Store Bistro Bookstore Bowling Alley Breakfast Spot Bubble Tea Shop Burger Joint Burrito Place Bus Line Bus Station Bus Stop Butcher Cafeteria Café Cajun / Creole Restaurant Camera Store Cantonese Restaurant Caribbean Restaurant Chinese Restaurant Clothing Store Coffee Shop College Stadium Construction & Landscaping Convenience Store Cosmetics Shop Deli / Bodega Department Store Dessert Shop Dim Sum Restaurant Diner Discount Store Dog Run Dumpling Restaurant Electronics Store Event Space Falafel Restaurant Fast Food Restaurant Filipino Restaurant Fish & Chips Shop Fish Market Flower Shop Food & Drink Shop Food Court Fried Chicken Joint Furniture / Home Store Garden Gas Station Gay Bar General Entertainment Gift Shop Golf Course Greek Restaurant Grocery Store Gym Gym / Fitness Center Gymnastics Gym Hakka Restaurant Harbor / Marina Hardware Store Hobby Shop Hockey Arena Home Service Hong Kong Restaurant Hookah Bar Hotel Hotpot Restaurant IT Services Ice Cream Shop Indian Restaurant Intersection Italian Restaurant Japanese Restaurant Jewelry Store Juice Bar Korean Restaurant Laundromat Light Rail Station Liquor Store Malay Restaurant Medical Center Mediterranean Restaurant Men's Store Metro Station Mexican Restaurant Middle Eastern Restaurant Miscellaneous Shop Mobile Phone Shop Movie Theater Moving Target Music Store Music Venue Nail Salon Neighborhood Noodle House North Indian Restaurant Optical Shop Paper / Office Supplies Store Park Pet Store Pharmacy Photography Studio Pizza Place Playground Pool Pool Hall Portuguese Restaurant Pub Rental Car Location Restaurant Road Salad Place Sandwich Place Sculpture Garden Seafood Restaurant Shoe Store Shop & Service Shopping Mall Skating Rink Smoke Shop Smoothie Shop Soccer Field Spa Sporting Goods Shop Sports Bar Sri Lankan Restaurant Steakhouse Storage Facility Supermarket Sushi Restaurant Taco Place Taiwanese Restaurant Tattoo Parlor Tea Room Tennis Court Thai Restaurant Theater Thrift / Vintage Store Toy / Game Store Trail Train Station Turkish Restaurant Vegetarian / Vegan Restaurant Video Game Store Vietnamese Restaurant Wings Joint Women's Store Yoga Studio
0 A & A Child Care Centre 0.0 0.00000 0.0 0.000000 0.0 0.0 0.0 0.000000 0.052632 0.0 0.052632 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.052632 0.000000 0.00000 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.00000 0.00000 0.157895 0.00000 0.052632 0.0 0.0 0.0 0.00000 0.00000 0.0 0.052632 0.0 0.0 0.000000 0.0 0.052632 0.0 0.00000 0.0000 0.052632 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.052632 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.00000 0.0 0.0 0.105263 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00000 0.0 0.00000 0.0 0.000000 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.000000 0.0 0.00000 0.0 0.0 0.105263 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.105263 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.052632 0.0 0.052632 0.0 0.0 0.0
1 Abacus Day Care Centre (629735 Ontario Inc.) 0.0 0.03125 0.0 0.000000 0.0 0.0 0.0 0.000000 0.000000 0.0 0.031250 0.031250 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.031250 0.000000 0.031250 0.03125 0.0 0.0 0.0 0.0 0.0 0.03125 0.0 0.0 0.03125 0.03125 0.000000 0.03125 0.000000 0.0 0.0 0.0 0.03125 0.03125 0.0 0.000000 0.0 0.0 0.000000 0.0 0.000000 0.0 0.03125 0.0625 0.062500 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.03125 0.03125 0.0 0.0 0.0 0.03125 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.03125 0.0 0.0 0.031250 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.03125 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.03125 0.0 0.03125 0.0 0.062500 0.0 0.0 0.0 0.0 0.03125 0.0 0.0 0.0 0.0 0.000000 0.0 0.03125 0.0 0.0 0.031250 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.03125 0.03125 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.000000 0.0 0.0 0.0
2 Absorbent Minds 0.0 0.00000 0.0 0.066667 0.0 0.0 0.0 0.066667 0.000000 0.0 0.000000 0.066667 0.066667 0.0 0.0 0.0 0.0 0.0 0.0 0.133333 0.000000 0.066667 0.00000 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.00000 0.00000 0.000000 0.00000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.000000 0.0 0.0 0.066667 0.0 0.000000 0.0 0.00000 0.0000 0.000000 0.0 0.0 0.0 0.0 0.066667 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.066667 0.0 0.0 0.00000 0.0 0.0 0.000000 0.0 0.0 0.066667 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00000 0.0 0.00000 0.0 0.133333 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.066667 0.0 0.00000 0.0 0.0 0.000000 0.0 0.0 0.066667 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.000000 0.0 0.0 0.0
3 Absorbent Minds 2 0.0 0.00000 0.0 0.083333 0.0 0.0 0.0 0.083333 0.000000 0.0 0.000000 0.000000 0.083333 0.0 0.0 0.0 0.0 0.0 0.0 0.166667 0.000000 0.083333 0.00000 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.00000 0.00000 0.000000 0.00000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.000000 0.0 0.0 0.000000 0.0 0.000000 0.0 0.00000 0.0000 0.000000 0.0 0.0 0.0 0.0 0.083333 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.083333 0.0 0.0 0.00000 0.0 0.0 0.000000 0.0 0.0 0.083333 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00 0.00000 0.0 0.00000 0.0 0.166667 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.083333 0.0 0.00000 0.0 0.0 0.000000 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.000000 0.0 0.0 0.0
4 After Four Children's Enrichment Program 0.0 0.00000 0.0 0.000000 0.0 0.0 0.0 0.000000 0.000000 0.0 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.000000 0.000000 0.00000 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.00000 0.00000 0.000000 0.00000 0.000000 0.0 0.0 0.0 0.00000 0.00000 0.0 0.000000 0.0 0.0 0.000000 0.0 0.000000 0.0 0.00000 0.0000 0.000000 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.00000 0.0 0.0 0.0 0.25000 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.00000 0.0 0.0 0.000000 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.25 0.00000 0.0 0.00000 0.0 0.250000 0.0 0.0 0.0 0.0 0.00000 0.0 0.0 0.0 0.0 0.000000 0.0 0.00000 0.0 0.0 0.000000 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00000 0.25000 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.000000 0.0 0.0 0.0
In [85]:
# Check new size:
toronto_grouped.shape
Out[85]:
(193, 163)
In [86]:
# Let's print each care_center along with the top 5 most common venues
num_top_venues = 5
for neigh in toronto_grouped['care_center']:
    print("----"+neigh+"----")
    temp = toronto_grouped[toronto_grouped['care_center'] == neigh].T.reset_index()
    temp.columns = ['venue','freq']
    temp = temp.iloc[1:]
    temp['freq'] = temp['freq'].astype(float)
    temp = temp.round({'freq': 2})
    print(temp.sort_values('freq', ascending=False).reset_index(drop=True).head(num_top_venues))
    print('\n')
----A & A Child Care Centre----
                venue  freq
0  Chinese Restaurant  0.16
1            Tea Room  0.11
2       Shopping Mall  0.11
3   Korean Restaurant  0.11
4         Coffee Shop  0.05


----Abacus Day Care Centre (629735 Ontario Inc.)----
                  venue  freq
0  Fast Food Restaurant  0.06
1    Falafel Restaurant  0.06
2           Pizza Place  0.06
3    Seafood Restaurant  0.03
4         Grocery Store  0.03


----Absorbent Minds----
               venue  freq
0        Pizza Place  0.13
1     Breakfast Spot  0.13
2     Sandwich Place  0.07
3       Liquor Store  0.07
4  Food & Drink Shop  0.07


----Absorbent Minds 2----
               venue  freq
0     Breakfast Spot  0.17
1        Pizza Place  0.17
2  Indian Restaurant  0.08
3    Automotive Shop  0.08
4       Burger Joint  0.08


----After Four Children's Enrichment Program----
                           venue  freq
0               Hakka Restaurant  0.25
1  Paper / Office Supplies Store  0.25
2               Sushi Restaurant  0.25
3                    Pizza Place  0.25
4                    Music Store  0.00


----Agape Christian Montessori School (2236800 Ontario Inc.)----
                venue  freq
0  Chinese Restaurant  0.20
1              Bakery  0.13
2   Korean Restaurant  0.13
3        Dessert Shop  0.07
4        Noodle House  0.07


----Agincourt Montessori School Inc.----
                   venue  freq
0     Chinese Restaurant  0.33
1       Asian Restaurant  0.11
2  Vietnamese Restaurant  0.11
3      Korean Restaurant  0.11
4   Hong Kong Restaurant  0.11


----Agincourt Temple Day Care(Governing Council Of The Salvation Army)----
                venue  freq
0                Park  0.17
1                Pool  0.17
2  Athletics & Sports  0.17
3         Coffee Shop  0.17
4        Tennis Court  0.17


----All My Children Child Care----
                 venue  freq
0               Bakery  0.07
1   Chinese Restaurant  0.07
2  Japanese Restaurant  0.03
3        Movie Theater  0.03
4  Sporting Goods Shop  0.03


----Alvin Curling Ymca----
                           venue  freq
0                          Trail   1.0
1             African Restaurant   0.0
2  Paper / Office Supplies Store   0.0
3                  Moving Target   0.0
4                    Music Store   0.0


----Angel Child Care Learning Centre (2042806 Ontario Inc.)----
                venue  freq
0  Chinese Restaurant  0.06
1      Ice Cream Shop  0.06
2              Bakery  0.06
3         Pizza Place  0.03
4       Shopping Mall  0.03


----Antrim Child Care----
                    venue  freq
0  Furniture / Home Store  0.08
1          Sandwich Place  0.06
2             Men's Store  0.06
3             Coffee Shop  0.06
4           Burrito Place  0.06


----Apple Day Care Centre----
                  venue  freq
0           Coffee Shop  0.25
1                   Pub  0.12
2        Discount Store  0.12
3  Fast Food Restaurant  0.12
4    Chinese Restaurant  0.12


----Archway Montessori School----
                  venue  freq
0  Fast Food Restaurant  0.15
1                 Diner  0.10
2         Grocery Store  0.10
3                   Pub  0.05
4      Toy / Game Store  0.05


----Avalon Children's Montessori School----
                venue  freq
0          Playground   0.5
1         Golf Course   0.5
2  African Restaurant   0.0
3        Optical Shop   0.0
4         Music Store   0.0


----Banting And Best Child Care Centre----
                venue  freq
0  Chinese Restaurant  0.23
1      Discount Store  0.08
2          Restaurant  0.08
3  Dim Sum Restaurant  0.08
4       Grocery Store  0.08


----Banting And Best Schoolage Satellite----
                venue  freq
0  Chinese Restaurant  0.25
1      Discount Store  0.08
2          Restaurant  0.08
3  Dim Sum Restaurant  0.08
4           BBQ Joint  0.08


----Bay Mills Early Learning & Child Care Centre----
                 venue  freq
0          Pizza Place   0.2
1             Pharmacy   0.2
2   Chinese Restaurant   0.1
3      Thai Restaurant   0.1
4  Fried Chicken Joint   0.1


----Baylawn Co-Operative Preschool----
                  venue  freq
0    Chinese Restaurant  0.20
1   Japanese Restaurant  0.07
2  Gym / Fitness Center  0.07
3   Filipino Restaurant  0.07
4           Coffee Shop  0.07


----Beechgrove Sunshine Child Care----
                venue  freq
0               Hotel   0.4
1                 Bar   0.2
2      Breakfast Spot   0.2
3         Pizza Place   0.2
4  African Restaurant   0.0


----Berner Trail Early Learning & Child Care Centre----
                           venue  freq
0                           Pool   0.5
1                       Bus Stop   0.5
2             African Restaurant   0.0
3  Paper / Office Supplies Store   0.0
4                    Music Venue   0.0


----Better Beginnings Nursery School----
          venue  freq
0   Pizza Place  0.29
1   Coffee Shop  0.29
2  Burger Joint  0.14
3    Beer Store  0.14
4           Pub  0.14


----Beverly Glen Ymca----
                    venue  freq
0    Fast Food Restaurant  0.17
1      Chinese Restaurant  0.17
2  Thrift / Vintage Store  0.08
3           Grocery Store  0.08
4          Sandwich Place  0.08


----Big Bears Daycare----
                 venue  freq
0          Coffee Shop  0.19
1       Sandwich Place  0.12
2       Discount Store  0.06
3               Bakery  0.06
4  Fried Chicken Joint  0.06


----Birchmount Bluffs Neighbourhood Centre----
                   venue  freq
0           Skating Rink  0.25
1  General Entertainment  0.25
2        College Stadium  0.25
3                   Café  0.25
4     African Restaurant  0.00


----Birchmount Place Centre For Early Learning----
                  venue  freq
0           Pizza Place   0.2
1              Pharmacy   0.2
2           Golf Course   0.1
3   Fried Chicken Joint   0.1
4  Fast Food Restaurant   0.1


----Birds And Bees Day Care Centre----
                venue  freq
0      Discount Store  0.12
1         Coffee Shop  0.12
2  Chinese Restaurant  0.12
3      Sandwich Place  0.06
4                Bank  0.06


----Blaisdale Montessori School----
                venue  freq
0               Diner  0.14
1      Sandwich Place  0.14
2   Mobile Phone Shop  0.14
3                 Gym  0.14
4  Chinese Restaurant  0.14


----Blessed Pier Giorgio Frassati Extended Day Program----
           venue  freq
0  Shopping Mall   1.0
1  Movie Theater   0.0
2    Music Store   0.0
3    Music Venue   0.0
4     Nail Salon   0.0


----Bridlegrove Daycare Centre----
                  venue  freq
0           Pizza Place  0.17
1           Coffee Shop  0.08
2  Fast Food Restaurant  0.08
3    Chinese Restaurant  0.08
4            Beer Store  0.08


----Bridlewood Jr Ymca----
                  venue  freq
0                  Park  0.50
1  Cantonese Restaurant  0.25
2    Seafood Restaurant  0.25
3           Music Venue  0.00
4            Nail Salon  0.00


----Brimwood School Age Ymca----
               venue  freq
0             Bakery  0.14
1  Indian Restaurant  0.07
2      Movie Theater  0.07
3          Gift Shop  0.07
4         Taco Place  0.07


----Broad View French Montessori School II Limited----
                           venue  freq
0                    Pizza Place  0.50
1                    Coffee Shop  0.25
2                     Beer Store  0.25
3             African Restaurant  0.00
4  Paper / Office Supplies Store  0.00


----C.D.Farquharson Jr Ymca----
                  venue  freq
0    Chinese Restaurant  0.31
1         Shopping Mall  0.19
2            Restaurant  0.06
3  Cantonese Restaurant  0.06
4      Malay Restaurant  0.06


----Cambridge Place Centre For Early Learning----
                  venue  freq
0        Baseball Field  0.08
1                Bakery  0.08
2           Golf Course  0.08
3  Gym / Fitness Center  0.08
4           Coffee Shop  0.08


----Canadiana Court Early Learning & Child Care Centre----
                  venue  freq
0  Fast Food Restaurant   0.4
1      Asian Restaurant   0.2
2   Sporting Goods Shop   0.2
3         Grocery Store   0.2
4    African Restaurant   0.0


----Cardinal Leger Child Care Centre (Scarborough)----
                venue  freq
0   Convenience Store  0.25
1        Home Service  0.25
2        Neighborhood  0.25
3            Pharmacy  0.25
4  African Restaurant  0.00


----Cedarbrae Day Nurseries (1385 Midland)----
                  venue  freq
0  Fast Food Restaurant  0.17
1         Grocery Store  0.17
2           Coffee Shop  0.08
3  Caribbean Restaurant  0.08
4     Indian Restaurant  0.08


----Cedarbrae Day Nurseries (20 Greencrest)----
                    venue  freq
0    Fast Food Restaurant  0.12
1          Discount Store  0.08
2             Coffee Shop  0.08
3              Beer Store  0.04
4  Thrift / Vintage Store  0.04


----Cedarbrae Day Nursery (1375 Midland)----
                  venue  freq
0  Fast Food Restaurant  0.17
1         Grocery Store  0.17
2           Coffee Shop  0.08
3  Caribbean Restaurant  0.08
4     Indian Restaurant  0.08


----Centenary Seven Oaks Early Learning & Child Care Centre----
               venue  freq
0     Sandwich Place  0.22
1        Coffee Shop  0.22
2         Beer Store  0.11
3  Convenience Store  0.11
4  Electronics Store  0.11


----Centennial College Progress Campus Child Care Centre(941 Progress)----
                           venue  freq
0                    Coffee Shop  0.50
1                         Bistro  0.25
2                            Spa  0.25
3             African Restaurant  0.00
4  Paper / Office Supplies Store  0.00


----Charlottetown Blvd. Childcare Centre----
               venue  freq
0        Yoga Studio  0.25
1  Convenience Store  0.25
2      Grocery Store  0.25
3                Pub  0.25
4               Pool  0.00


----Chartland Child Care Inc----
                venue  freq
0         Pizza Place  0.25
1         Coffee Shop  0.25
2            Pharmacy  0.25
3         Gas Station  0.25
4  African Restaurant  0.00


----Cheer Day Care Centre----
                           venue  freq
0  Paper / Office Supplies Store  0.09
1              Food & Drink Shop  0.09
2                  Grocery Store  0.09
3                    Pizza Place  0.09
4           Hong Kong Restaurant  0.09


----Chester Le Early Learning & Child Care Centre----
                  venue  freq
0        Sandwich Place  0.12
1     Convenience Store  0.12
2            Beer Store  0.12
3  Caribbean Restaurant  0.12
4              Pharmacy  0.12


----Children Of Tomorrow----
                           venue  freq
0           Fast Food Restaurant  0.50
1      Middle Eastern Restaurant  0.25
2                     Playground  0.25
3  Paper / Office Supplies Store  0.00
4                    Music Venue  0.00


----Children Of Tomorrow - John McCrae----
                           venue  freq
0                     Playground  0.50
1                    Pizza Place  0.25
2           Caribbean Restaurant  0.25
3             African Restaurant  0.00
4  Paper / Office Supplies Store  0.00


----Children's Village #1 Day Care Centre----
               venue  freq
0             Bakery  0.15
1        Coffee Shop  0.15
2           Bus Line  0.08
3  Indian Restaurant  0.08
4   Asian Restaurant  0.08


----Children's Village Day Care Centre #3----
                  venue  freq
0  Fast Food Restaurant  0.25
1           Coffee Shop  0.25
2            Beer Store  0.25
3              Pharmacy  0.25
4                  Park  0.00


----Circles In The Sun Montessori Academy----
                  venue  freq
0            Steakhouse  0.12
1                 Hotel  0.12
2        Sandwich Place  0.12
3           Pizza Place  0.12
4  Fast Food Restaurant  0.12


----Cliffcrest Day Care Centre----
                  venue  freq
0  Fast Food Restaurant  0.38
1            Restaurant  0.12
2     Convenience Store  0.12
3        Sandwich Place  0.12
4         Train Station  0.12


----Cougar Court Child Care Centre 15----
                  venue  freq
0           Coffee Shop  0.25
1         Shopping Mall  0.12
2            Beer Store  0.12
3              Pharmacy  0.12
4  Fast Food Restaurant  0.12


----Cougar Court Child Care Centre 25----
                  venue  freq
0           Coffee Shop  0.25
1         Shopping Mall  0.12
2            Beer Store  0.12
3              Pharmacy  0.12
4  Fast Food Restaurant  0.12


----Creative Minds Montessori Academy----
                           venue  freq
0                           Park   0.5
1                            Bar   0.5
2  Paper / Office Supplies Store   0.0
3                    Music Store   0.0
4                    Music Venue   0.0


----David Lewis Jr Ymca----
                venue  freq
0         Pizza Place   1.0
1  African Restaurant   0.0
2        Optical Shop   0.0
3       Moving Target   0.0
4         Music Store   0.0


----Dearham Wood Daycare----
                venue  freq
0   Convenience Store   0.5
1      Baseball Field   0.5
2  African Restaurant   0.0
3                Park   0.0
4         Music Venue   0.0


----Denton Place Centre For Early Learning----
                  venue  freq
0        Baseball Field  0.08
1                Bakery  0.08
2           Golf Course  0.08
3  Gym / Fitness Center  0.08
4           Coffee Shop  0.08


----Dian Childcare Centre Inc.----
                           venue  freq
0                        Dog Run   0.5
1                          Trail   0.5
2             African Restaurant   0.0
3  Paper / Office Supplies Store   0.0
4                    Music Store   0.0


----Discovery Place Child Care Centre Ltd.----
                  venue  freq
0            Steakhouse  0.14
1        Sandwich Place  0.14
2           Pizza Place  0.14
3  Fast Food Restaurant  0.14
4           Coffee Shop  0.14


----East Scarb. Boys' & Girls' Club(Eastside Child Care Centre 20 Waldock)----
           venue  freq
0  Moving Target  0.25
1           Park  0.25
2    Auto Garage  0.25
3         Bakery  0.25
4    Music Store  0.00


----East Scarb. Child Care Centre(East Scarb. Boys & Girls Club----
                  venue  freq
0           Pizza Place  0.14
1  Fast Food Restaurant  0.10
2         Grocery Store  0.07
3           Coffee Shop  0.07
4            Beer Store  0.03


----Eastside Club----
                venue  freq
0       Train Station   0.4
1       Moving Target   0.2
2      Baseball Field   0.2
3    Storage Facility   0.2
4  African Restaurant   0.0


----Ellesmere Montessori School----
                           venue  freq
0                    Coffee Shop  0.17
1                 Discount Store  0.08
2               Sushi Restaurant  0.08
3  Paper / Office Supplies Store  0.08
4                      Pet Store  0.08


----Ellington Montessori School----
                   venue  freq
0          Burrito Place  0.17
1             Restaurant  0.17
2                  Hotel  0.17
3  Vietnamese Restaurant  0.17
4            Pizza Place  0.17


----Enjoy Learning Centre----
                  venue  freq
0             Pet Store  0.09
1  Cantonese Restaurant  0.09
2   Dumpling Restaurant  0.09
3          Noodle House  0.09
4           Pizza Place  0.09


----Enquiring Minds Montessori----
                    venue  freq
0  Furniture / Home Store  0.07
1          Sandwich Place  0.05
2             Men's Store  0.05
3               Pet Store  0.05
4             Coffee Shop  0.05


----Epiphany Of Our Lord Jr Ymca----
                  venue  freq
0         Deli / Bodega  0.25
1        Sandwich Place  0.25
2                Bakery  0.25
3  Caribbean Restaurant  0.25
4    African Restaurant  0.00


----Fairmount Sunshine Child Care----
                  venue  freq
0                  Park  0.25
1           Pizza Place  0.25
2  Fast Food Restaurant  0.25
3          Burger Joint  0.25
4          Optical Shop  0.00


----Fleming Jr Ymca----
                           venue  freq
0                    Pizza Place   0.5
1                            Bar   0.5
2             African Restaurant   0.0
3  Paper / Office Supplies Store   0.0
4                    Music Store   0.0


----Follow The Child----
            venue  freq
0     Pizza Place  0.25
1            Park  0.12
2    Burger Joint  0.12
3  Sandwich Place  0.12
4     Coffee Shop  0.12


----Friendly Little Campus (2037711 Ontario Ltd)----
                  venue  freq
0                  Bank  0.12
1                 Diner  0.12
2         Grocery Store  0.12
3           Pizza Place  0.12
4  Fast Food Restaurant  0.12


----Friendly Little Campus Daycare 2----
               venue  freq
0     Breakfast Spot  0.33
1                Bar  0.17
2   Asian Restaurant  0.17
3  Indian Restaurant  0.17
4    Automotive Shop  0.17


----Future Stars Child Care Centre----
                           venue  freq
0                    Pizza Place  0.50
1                   Home Service  0.25
2                      Juice Bar  0.25
3             African Restaurant  0.00
4  Paper / Office Supplies Store  0.00


----Galloway Early Learning & Child Care Centre----
                 venue  freq
0  Rental Car Location  0.17
1    Electronics Store  0.17
2                  Spa  0.17
3   Mexican Restaurant  0.17
4       Medical Center  0.17


----Garderie Chez Tante Laure----
                venue  freq
0  Chinese Restaurant  0.17
1   Convenience Store  0.11
2          Restaurant  0.11
3                Park  0.11
4      Discount Store  0.06


----Garderie Mon Petit Jardin----
                           venue  freq
0           Fast Food Restaurant   0.5
1                           Park   0.5
2  Paper / Office Supplies Store   0.0
3                    Music Store   0.0
4                    Music Venue   0.0


----Gateway Montessori School----
                       venue  freq
0  Middle Eastern Restaurant  0.19
1                Pizza Place  0.15
2               Burger Joint  0.07
3              Grocery Store  0.07
4               Intersection  0.07


----Gilder Early Learning & Child Care Centre----
                 venue  freq
0  Rental Car Location  0.11
1       Discount Store  0.11
2          Wings Joint  0.11
3         Burger Joint  0.11
4          Pizza Place  0.11


----Gilder Satellite Early Learning & Child Care Centre----
                  venue  freq
0              Pharmacy  0.18
1   Rental Car Location  0.09
2  Fast Food Restaurant  0.09
3        Discount Store  0.09
4          Burger Joint  0.09


----Glamorgan School Age Ymca----
               venue  freq
0               Park  0.33
1        Music Venue  0.17
2     Sandwich Place  0.17
3  Electronics Store  0.17
4      Moving Target  0.17


----Golf Road School Child Care Centre----
                  venue  freq
0      Department Store  0.12
1  Fast Food Restaurant  0.12
2           Supermarket  0.12
3                  Park  0.12
4    Chinese Restaurant  0.12


----Good Shepherd Day Care Centre----
                  venue  freq
0           Pizza Place  0.29
1  Fast Food Restaurant  0.14
2   Fried Chicken Joint  0.14
3              Pharmacy  0.14
4    Chinese Restaurant  0.14


----Growing Tykes Learning Centre (4105 Lawrence Avenue East)----
                    venue  freq
0  Thrift / Vintage Store  0.14
1          Medical Center  0.14
2             Pizza Place  0.14
3      Mexican Restaurant  0.14
4       Electronics Store  0.14


----Growing Tykes Learning Centre 910----
                        venue  freq
0           Indian Restaurant   0.4
1              Cosmetics Shop   0.2
2  Construction & Landscaping   0.2
3           Fish & Chips Shop   0.2
4                        Park   0.0


----Guildwood Child Care----
           venue  freq
0           Park   0.5
1       Bus Line   0.5
2  Moving Target   0.0
3    Music Venue   0.0
4     Nail Salon   0.0


----Guildwood Childcare Centre Satellite (Evans Corp 85 Livingstone)----
           venue  freq
0  Grocery Store  0.25
1           Park  0.12
2    Pizza Place  0.12
3     Sports Bar  0.12
4    Coffee Shop  0.12


----Heart Beatz - Halbert Child Care Site----
            venue  freq
0            Bank  0.17
1  Sandwich Place  0.17
2          Bistro  0.17
3     Coffee Shop  0.17
4        Pharmacy  0.17


----Heart Beatz Child Care - Solaris Site----
                    venue  freq
0          Discount Store   0.1
1     Arts & Crafts Store   0.1
2              Restaurant   0.1
3  Furniture / Home Store   0.1
4                   Hotel   0.1


----Heritage Child Care & Early Learning - Milliken Site----
                  venue  freq
0    Chinese Restaurant  0.19
1             BBQ Joint  0.12
2  Fast Food Restaurant  0.12
3        Hardware Store  0.06
4                  Park  0.06


----Heritage Child Care & Early Learning Centre----
                venue  freq
0            Pharmacy   0.4
1                Park   0.2
2  Chinese Restaurant   0.2
3                 Gym   0.2
4        Optical Shop   0.0


----Highland Creek Montessori Pre-School----
                           venue  freq
0                 Breakfast Spot  0.50
1                   Burger Joint  0.25
2             Italian Restaurant  0.25
3  Paper / Office Supplies Store  0.00
4                    Music Store  0.00


----Hilltop Daycare Centre----
                  venue  freq
0  Fast Food Restaurant  0.33
1          Intersection  0.33
2            Restaurant  0.33
3    African Restaurant  0.00
4           Music Venue  0.00


----Holland-Bloorview Kids Rehab. (Scarborough Site)----
                  venue  freq
0         Moving Target  0.25
1            Playground  0.25
2                  Park  0.25
3  Gym / Fitness Center  0.25
4          Optical Shop  0.00


----Holy Spirit Jr Ymca----
                 venue  freq
0             Pharmacy  0.22
1          Pizza Place  0.22
2  Rental Car Location  0.11
3  Fried Chicken Joint  0.11
4      Thai Restaurant  0.11


----Hunter's Glen School Age Ymca----
                venue  freq
0         Bus Station   0.5
1                 Spa   0.5
2  African Restaurant   0.0
3       Moving Target   0.0
4         Music Venue   0.0


----Immanuel Day Care Centre----
                  venue  freq
0  Gym / Fitness Center  0.14
1            Restaurant  0.14
2   Japanese Restaurant  0.07
3                  Road  0.07
4           Salad Place  0.07


----Isabella Walton Child Care----
                 venue  freq
0  Rental Car Location  0.17
1            Pet Store  0.08
2  Sporting Goods Shop  0.08
3            Cafeteria  0.08
4     Greek Restaurant  0.08


----Jacob Tree Preschool----
                   venue  freq
0  Vietnamese Restaurant  0.29
1     Chinese Restaurant  0.14
2   Caribbean Restaurant  0.14
3       Greek Restaurant  0.14
4   Taiwanese Restaurant  0.14


----Jingbao Bilingual Children's Centre - Scarborough----
                venue  freq
0                Park   1.0
1  African Restaurant   0.0
2        Optical Shop   0.0
3       Moving Target   0.0
4         Music Store   0.0


----John A. Leslie Childcare - Scarborough----
                venue  freq
0      Breakfast Spot  0.25
1      Sandwich Place  0.25
2         Pizza Place  0.25
3     Harbor / Marina  0.25
4  African Restaurant  0.00


----Kenlinton Child Care Centre (Operator: Stonehill) Facility #16008----
                venue  freq
0                Bank  0.25
1      Sandwich Place  0.25
2         Coffee Shop  0.25
3  Chinese Restaurant  0.25
4           Pet Store  0.00


----Kennedy Road Kiddy Kare----
                venue  freq
0      Discount Store  0.33
1    Department Store  0.17
2         Coffee Shop  0.17
3          Hobby Shop  0.17
4  Chinese Restaurant  0.17


----Kiddies Lodge Day Care Centre----
                       venue  freq
0       Fast Food Restaurant  0.20
1               Intersection  0.07
2              Grocery Store  0.07
3                        Gym  0.07
4  Middle Eastern Restaurant  0.07


----Kids Love Day Care----
                venue  freq
0       Train Station   0.4
1       Moving Target   0.2
2      Baseball Field   0.2
3    Storage Facility   0.2
4  African Restaurant   0.0


----Kimbercroft Day Nursery (30 Kimbercroft Court)----
                 venue  freq
0             Pharmacy  0.17
1   Chinese Restaurant  0.08
2                 Park  0.08
3                Diner  0.08
4  American Restaurant  0.08


----Kimbercroft Day Nursery 2----
               venue  freq
0           Pharmacy  0.18
1               Park  0.09
2              Diner  0.09
3     Sandwich Place  0.09
4  Mobile Phone Shop  0.09


----Kingston Road East Early Learning And Child Care Centre----
                 venue  freq
0              Butcher  0.12
1                Hotel  0.12
2  Fried Chicken Joint  0.12
3          Pizza Place  0.12
4                 Café  0.12


----Knob Hill Day Nursery----
                venue  freq
0    Asian Restaurant   1.0
1  African Restaurant   0.0
2                Park   0.0
3         Music Store   0.0
4         Music Venue   0.0


----Knob Hill School Age Ymca----
                  venue  freq
0                  Pool  0.25
1            Playground  0.25
2           Pizza Place  0.25
3  Caribbean Restaurant  0.25
4    African Restaurant  0.00


----Kreative Kids Child Care Centre----
                   venue  freq
0     Chinese Restaurant  0.23
1                   Park  0.15
2            Supermarket  0.08
3  Vietnamese Restaurant  0.08
4            Pizza Place  0.08


----Kreative Kids Terry Fox----
                   venue  freq
0     Chinese Restaurant  0.25
1            Supermarket  0.12
2       Sushi Restaurant  0.12
3  Vietnamese Restaurant  0.12
4            Pizza Place  0.12


----Lawrence Avenue East Early Learning & Child Care Centre----
                  venue  freq
0           Pizza Place  0.33
1      Department Store  0.17
2        Sandwich Place  0.17
3    Chinese Restaurant  0.17
4  Fast Food Restaurant  0.17


----Learn With Me Children Centre Inc.----
             venue  freq
0            Diner   0.2
1  Thai Restaurant   0.2
2             Café   0.2
3             Bank   0.2
4   Discount Store   0.2


----Learning Jungle School - Kennedy Campus----
                           venue  freq
0  Paper / Office Supplies Store  0.09
1              Food & Drink Shop  0.09
2                  Grocery Store  0.09
3                    Pizza Place  0.09
4           Hong Kong Restaurant  0.09


----Lucy Maud Montgomery Jr Ymca----
                venue  freq
0        Home Service  0.25
1         Pizza Place  0.25
2       Movie Theater  0.25
3        Liquor Store  0.25
4  African Restaurant  0.00


----Lynngate Jr Ymca----
                  venue  freq
0  Fast Food Restaurant  0.17
1   Fried Chicken Joint  0.17
2           Pizza Place  0.17
3              Pharmacy  0.17
4    Chinese Restaurant  0.17


----Mackie Sunshine Child Care Centre----
            venue  freq
0         Theater  0.18
1  Discount Store  0.09
2    Skating Rink  0.09
3         Butcher  0.09
4     Pizza Place  0.09


----Malvern Early Learning & Child Care Centre----
               venue  freq
0        Pizza Place  0.22
1           Pharmacy  0.22
2    Bubble Tea Shop  0.11
3  Convenience Store  0.11
4     Sandwich Place  0.11


----Mandarin Child Care Centre----
          venue  freq
0          Park  0.25
1  Skating Rink  0.25
2    Restaurant  0.25
3    Hookah Bar  0.25
4   Music Store  0.00


----Mary Ward Child Care Centre----
                           venue  freq
0             Chinese Restaurant  0.18
1  Paper / Office Supplies Store  0.09
2            Japanese Restaurant  0.09
3             Athletics & Sports  0.09
4                    Pizza Place  0.09


----Maryvale Jr Ymca----
                           venue  freq
0                       Pharmacy   0.2
1                 Discount Store   0.2
2                  Bowling Alley   0.2
3                    Coffee Shop   0.2
4  Paper / Office Supplies Store   0.2


----Meadowvale Daycare Centre----
                       venue  freq
0  Middle Eastern Restaurant   1.0
1         African Restaurant   0.0
2              Movie Theater   0.0
3                Music Store   0.0
4                Music Venue   0.0


----Midland Child Care Centre----
                  venue  freq
0    Chinese Restaurant  0.24
1   Japanese Restaurant  0.12
2                   Gym  0.06
3  Fast Food Restaurant  0.06
4    Seafood Restaurant  0.06


----Montessori Village Day Nursery----
                           venue  freq
0                 Breakfast Spot  0.50
1                   Burger Joint  0.25
2             Italian Restaurant  0.25
3  Paper / Office Supplies Store  0.00
4                    Music Store  0.00


----Morningside Children's Centre----
                  venue  freq
0           Pizza Place  0.16
1  Fast Food Restaurant  0.09
2           Coffee Shop  0.06
3        Sandwich Place  0.03
4           Supermarket  0.03


----Morrish Jr Ymca----
                           venue  freq
0                           Park  0.33
1              Convenience Store  0.33
2                   Tennis Court  0.33
3  Paper / Office Supplies Store  0.00
4                    Music Store  0.00


----Mother Of Compassion Child Care----
                           venue  freq
0              Convenience Store  0.33
1                     Playground  0.33
2                    Pizza Place  0.33
3             African Restaurant  0.00
4  Paper / Office Supplies Store  0.00


----N'Sheemaehn----
               venue  freq
0       Burger Joint  0.29
1        Coffee Shop  0.29
2                Gym  0.14
3  Fish & Chips Shop  0.14
4         Restaurant  0.14


----N.Y.A.D. Cedar Drive----
                  venue  freq
0         Shopping Mall  0.12
1            Beer Store  0.12
2                   Pub  0.12
3  Fast Food Restaurant  0.12
4           Coffee Shop  0.12


----N.Y.A.D. Corvette----
                venue  freq
0      Discount Store  0.33
1    Department Store  0.17
2         Coffee Shop  0.17
3          Hobby Shop  0.17
4  Chinese Restaurant  0.17


----N.Y.A.D. Donwood----
          venue  freq
0       Gay Bar  0.25
1     Gift Shop  0.25
2          Park  0.25
3        Bakery  0.25
4  Optical Shop  0.00


----N.Y.A.D. Guildwood----
            venue  freq
0   Train Station  0.25
1            Park  0.12
2  Sandwich Place  0.12
3   Grocery Store  0.12
4     Coffee Shop  0.12


----N.Y.A.D. Mason Road----
                  venue  freq
0     Indian Restaurant  0.25
1        Sandwich Place  0.25
2         Big Box Store  0.25
3  Fast Food Restaurant  0.25
4            Playground  0.00


----N.Y.A.D. Midland----
                  venue  freq
0         Grocery Store  0.25
1  Fast Food Restaurant  0.25
2    Chinese Restaurant  0.25
3                Bakery  0.25
4    African Restaurant  0.00


----N.Y.A.D. Progress----
                 venue  freq
0                Hotel   0.2
1          Coffee Shop   0.2
2           Steakhouse   0.1
3  American Restaurant   0.1
4                  Spa   0.1


----Native Child & Family Life Centre - 156 Galloway----
                    venue  freq
0     Rental Car Location  0.12
1             Auto Garage  0.12
2                    Park  0.12
3      Chinese Restaurant  0.12
4  Thrift / Vintage Store  0.12


----Nobi Montessori School & Daycare----
                    venue  freq
0      Chinese Restaurant  0.14
1             Auto Garage  0.14
2          Baseball Field  0.14
3  Thrift / Vintage Store  0.14
4        Storage Facility  0.14


----Nyad - Scarborough Village (15 Luella Street)----
               venue  freq
0           Pharmacy  0.14
1         Beer Store  0.14
2  Indian Restaurant  0.14
3     Sandwich Place  0.14
4        Coffee Shop  0.14


----Oakridge Junior Playcare----
                  venue  freq
0   Filipino Restaurant   0.2
1         Metro Station   0.2
2            Beer Store   0.2
3          Liquor Store   0.2
4  Fast Food Restaurant   0.2


----Our Lady Of Fatima Ymca----
                  venue  freq
0          Intersection  0.22
1     Convenience Store  0.22
2  Fast Food Restaurant  0.22
3                  Park  0.11
4        Sandwich Place  0.11


----Our Lady Of Grace Jr Ymca----
                  venue  freq
0        Shop & Service  0.25
1           Pizza Place  0.25
2            Hobby Shop  0.25
3  Caribbean Restaurant  0.25
4                  Park  0.00


----Our Lady Of Wisdom Ymca----
                           venue  freq
0               Hakka Restaurant  0.25
1  Paper / Office Supplies Store  0.25
2               Sushi Restaurant  0.25
3                    Pizza Place  0.25
4                    Music Store  0.00


----Pauline Johnson School Age Ymca----
                venue  freq
0        Intersection  0.25
1         Pizza Place  0.25
2         Golf Course  0.25
3       Shopping Mall  0.25
4  African Restaurant  0.00


----Percy Williams Ymca----
                 venue  freq
0        Movie Theater  0.04
1       Discount Store  0.04
2   Chinese Restaurant  0.04
3                  Spa  0.04
4  Sporting Goods Shop  0.04


----Plasp Inglewood Heights Junior Public School----
                  venue  freq
0              Pharmacy   0.1
1  Fast Food Restaurant   0.1
2         Grocery Store   0.1
3  Cantonese Restaurant   0.1
4         Shopping Mall   0.1


----Plasp North Bridlewood Junior Public School----
                venue  freq
0  African Restaurant   0.5
1                Park   0.5
2        Optical Shop   0.0
3       Moving Target   0.0
4         Music Store   0.0


----Play Care Program/ West Scarborough Neighbourhood Com. Centre.----
                venue  freq
0             Dog Run  0.33
1               Trail  0.33
2          Smoke Shop  0.33
3  African Restaurant  0.00
4        Optical Shop  0.00


----Port Royal Jr Ymca----
                venue  freq
0  Chinese Restaurant  0.29
1   Convenience Store  0.14
2              Bakery  0.14
3  Seafood Restaurant  0.14
4         Pizza Place  0.14


----Port Union Panthers----
                 venue  freq
0                  Gym   0.1
1  Japanese Restaurant   0.1
2       Sandwich Place   0.1
3    Convenience Store   0.1
4         Liquor Store   0.1


----Precious Blood Jr Ymca Elp----
                       venue  freq
0  Middle Eastern Restaurant  0.27
1         Chinese Restaurant  0.18
2          Indian Restaurant  0.09
3           Asian Restaurant  0.09
4                Wings Joint  0.09


----Progress Childcare (Scarborough Inc. #1 (3 Glamorgan)----
                  venue  freq
0           Supermarket  0.08
1             Bookstore  0.08
2  Fast Food Restaurant  0.08
3        Sandwich Place  0.08
4             Pet Store  0.08


----Rainbow Village Childcare Centre (Mid-Scarborough Child Care)----
               venue  freq
0     Discount Store  0.13
1        Coffee Shop  0.13
2               Bank  0.07
3        Pizza Place  0.07
4  Convenience Store  0.07


----Rosalie Hall Child Development Centre----
               venue  freq
0            Dog Run  0.11
1     Sandwich Place  0.11
2     Breakfast Spot  0.11
3          Bookstore  0.11
4  Fish & Chips Shop  0.11


----Rouge Valley Jr Ymca----
                 venue  freq
0          Coffee Shop  0.14
1       Discount Store  0.07
2               Bakery  0.07
3  Fried Chicken Joint  0.07
4    Mobile Phone Shop  0.07


----Saint Nicholas Child Care Centre - Network----
                venue  freq
0  Chinese Restaurant  0.33
1       Shopping Mall  0.11
2            Bus Stop  0.11
3  Athletics & Sports  0.11
4         Pizza Place  0.11


----Sandbox Day Care Centre----
                venue  freq
0         Pizza Place   0.4
1   Indian Restaurant   0.2
2       Jewelry Store   0.2
3           Juice Bar   0.2
4  African Restaurant   0.0


----Scarborough Citadel Child Care----
                       venue  freq
0                Pizza Place  0.11
1               Burger Joint  0.11
2  Middle Eastern Restaurant  0.11
3               Intersection  0.05
4                        Bar  0.05


----Scarborough Day Nursery School----
                venue  freq
0               Diner  0.25
1      Discount Store  0.25
2                Café  0.25
3     Thai Restaurant  0.25
4  African Restaurant  0.00


----Scarborough Jr Ymca----
                venue  freq
0      Clothing Store  0.11
1         Coffee Shop  0.07
2          Restaurant  0.05
3  Light Rail Station  0.04
4            Tea Room  0.04


----Scarborough Village Day Nursery 1----
                  venue  freq
0  Fast Food Restaurant  0.25
1            Beer Store  0.12
2                   Gym  0.12
3           Coffee Shop  0.12
4              Pharmacy  0.12


----Scarborough Village Day Nursery 2----
                  venue  freq
0           Coffee Shop  0.14
1  Fast Food Restaurant  0.14
2               Theater  0.07
3                   Gym  0.07
4   Fried Chicken Joint  0.07


----Sheppard Square Day Nursery----
               venue  freq
0           Pharmacy   0.2
1               Park   0.1
2              Diner   0.1
3     Sandwich Place   0.1
4  Mobile Phone Shop   0.1


----Simcoe Sunshine Child Care----
                           venue  freq
0                           Park  0.67
1                          Trail  0.33
2  Paper / Office Supplies Store  0.00
3                  Moving Target  0.00
4                    Music Store  0.00


----Sir Samuel B Steele Jr Ymca----
                           venue  freq
0             Chinese Restaurant  0.50
1              Hotpot Restaurant  0.25
2             Miscellaneous Shop  0.25
3             African Restaurant  0.00
4  Paper / Office Supplies Store  0.00


----Smart Start Montessori School (1416786 Ontario Limited)----
                     venue  freq
0                     Park   0.4
1     Caribbean Restaurant   0.2
2        Convenience Store   0.2
3  North Indian Restaurant   0.2
4                Pet Store   0.0


----St. Aidan Early Learning Centre Network----
                venue  freq
0  Chinese Restaurant  0.50
1       Shopping Mall  0.25
2            Bus Stop  0.25
3                Park  0.00
4         Music Venue  0.00


----St. Bede Child Care Centre----
               venue  freq
0  Indian Restaurant   0.2
1                Bar   0.2
2        Pizza Place   0.2
3   Sculpture Garden   0.2
4      Grocery Store   0.2


----St. Boniface Jr Ymca----
                  venue  freq
0  Fast Food Restaurant  0.15
1           Coffee Shop  0.15
2               Theater  0.08
3               Butcher  0.08
4           Pizza Place  0.08


----St. Brendan Kindergarten Before & After School Program----
                venue  freq
0                Park   1.0
1  African Restaurant   0.0
2        Optical Shop   0.0
3       Moving Target   0.0
4         Music Store   0.0


----St. Crispins Day Care Centre----
                       venue  freq
0                 Sports Bar  0.25
1                Pizza Place  0.25
2              Train Station  0.25
3  Cajun / Creole Restaurant  0.25
4         African Restaurant  0.00


----St. Gabriel Lalemant----
           venue  freq
0    IT Services  0.33
1       Pharmacy  0.33
2           Park  0.33
3   Optical Shop  0.00
4  Moving Target  0.00


----St. Maria Goretti - Network Childcare Services----
                venue  freq
0         Coffee Shop  0.15
1      Discount Store  0.10
2  Chinese Restaurant  0.10
3         Bus Station  0.05
4                Bank  0.05


----St. Rose Of Lima Ymca Child Care----
                venue  freq
0  Chinese Restaurant  0.11
1         Pizza Place  0.11
2               Diner  0.11
3       Grocery Store  0.11
4           Bookstore  0.11


----St. Sylvester Child Care Centre----
                venue  freq
0  Athletics & Sports   0.2
1         Pizza Place   0.2
2        Tennis Court   0.2
3                Park   0.2
4         Flower Shop   0.2


----Sunshine Montessori School - North York----
                  venue  freq
0           Coffee Shop  0.13
1  Fast Food Restaurant  0.09
2        Sandwich Place  0.04
3      Hakka Restaurant  0.04
4            Restaurant  0.04


----Tamarack Day Care Centre (765566 Ontario Inc)----
                venue  freq
0  Chinese Restaurant  0.20
1   Korean Restaurant  0.12
2        Dessert Shop  0.08
3              Bakery  0.08
4         Coffee Shop  0.08


----Teach Me To Fly Preschool----
                    venue  freq
0  Furniture / Home Store   0.2
1              Playground   0.2
2             Pizza Place   0.2
3      Chinese Restaurant   0.2
4     Filipino Restaurant   0.2


----The Divine Infant Child Care Centre----
               venue  freq
0               Park  0.25
1     Sandwich Place  0.25
2              Trail  0.25
3  Mobile Phone Shop  0.25
4       Optical Shop  0.00


----The Squirrel's Nest Child Care Centre----
              venue  freq
0       Pizza Place  0.33
1  Storage Facility  0.17
2       Wings Joint  0.17
3       Coffee Shop  0.17
4            Bakery  0.17


----Tic Toc Day Care Centre Inc----
                venue  freq
0                Park  0.25
1       Deli / Bodega  0.25
2       Bowling Alley  0.25
3     Badminton Court  0.25
4  African Restaurant  0.00


----Timothy Eaton Infant & Toddler Centre----
                           venue  freq
0                           Park   0.5
1          Vietnamese Restaurant   0.5
2  Paper / Office Supplies Store   0.0
3                  Moving Target   0.0
4                    Music Store   0.0


----Today's Child Tomorrow's Future Children's Centre (290 Blantyre)----
                  venue  freq
0           Coffee Shop   0.3
1           Pizza Place   0.2
2         Grocery Store   0.2
3          Burger Joint   0.1
4  Fast Food Restaurant   0.1


----Today's Child Tomorrow's Future Children's Centre (725 Danforth)----
                  venue  freq
0          Soccer Field  0.25
1        Sandwich Place  0.25
2         Train Station  0.25
3  Fast Food Restaurant  0.25
4    African Restaurant  0.00


----Top Mandarin Day Care Centre----
                  venue  freq
0    Falafel Restaurant  0.18
1  Fast Food Restaurant  0.18
2                  Park  0.09
3         Deli / Bodega  0.09
4     Korean Restaurant  0.09


----Vradenburg Community Child Care Centre----
                venue  freq
0                Park  0.14
1        Intersection  0.14
2  Italian Restaurant  0.14
3      Discount Store  0.14
4      Sandwich Place  0.14


----Warden Woods Early Learning & Child Care Centre----
         venue  freq
0         Bank   0.2
1     Bus Stop   0.2
2  Coffee Shop   0.2
3        Trail   0.2
4         Park   0.2


----Warden Woods Satellite Early Learning & Child Care Centre----
                venue  freq
0             Dog Run  0.25
1            Bus Stop  0.25
2         Coffee Shop  0.25
3               Trail  0.25
4  African Restaurant  0.00


----Wexford Community Childcare Centre----
                  venue  freq
0         Moving Target  0.25
1            Playground  0.25
2                  Park  0.25
3  Gym / Fitness Center  0.25
4          Optical Shop  0.00


----Wexford Extended Day And School Age Program----
                       venue  freq
0  Middle Eastern Restaurant  0.20
1           Asian Restaurant  0.13
2              Grocery Store  0.13
3   Mediterranean Restaurant  0.13
4                Supermarket  0.07


----William G. Miller School Age Ymca----
                venue  freq
0              Garden  0.25
1  Athletics & Sports  0.25
2       Grocery Store  0.25
3                 Gym  0.25
4        Optical Shop  0.00


----William Tredway Jr. - Growing Tykes Learning Centre----
                        venue  freq
0         American Restaurant  0.33
1  Construction & Landscaping  0.33
2                        Park  0.33
3                        Pool  0.00
4                Optical Shop  0.00


----Woodland Nursery School----
         venue  freq
0         Bank   0.2
1      Dog Run   0.2
2     Bus Stop   0.2
3  Coffee Shop   0.2
4        Trail   0.2


Let's assume that you are staying at the 5600 Sheppard Ave E, Scarborough, Canada. So let's start by converting the address to its latitude and longitude coordinates.

In [87]:
address = '5600 Sheppard Ave E, Scarborough, Canada'

geolocator = Nominatim(user_agent="foursquare_agent")
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude
print(latitude, longitude)
43.794924 -79.2364314148795

Now, let's assume that you are searching for Day care centers for you children around your address. So, let's define a query to search for Day care centers that is within 20000 metres from your address.

In [88]:
search_query = 'child care center'
radius = 2500
print(search_query + ' .... OK!')
child care center .... OK!

Define the corresponding URL

In [89]:
url = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, latitude, longitude, VERSION, search_query, radius, LIMIT)
url
Out[89]:
'https://api.foursquare.com/v2/venues/search?client_id=LA4BGJCCVELUQ02LD33A0JONKW0GBN5TYC4PDW0JXYUN5OMO&client_secret=VZZEJ0RJMXENI2VG0HFQP13XFTR3U4MITOAA0MMH4TZG0LV5&ll=43.794924,-79.2364314148795&v=20180605&query=child care center&radius=2500&limit=100'

Send the GET Request and examine the results

In [90]:
results = requests.get(url).json()
results
Out[90]:
{'meta': {'code': 200, 'requestId': '5cb31faff594df78c14939c9'},
 'response': {'venues': [{'id': '57c8d67bcd1043c5b04493dc',
    'name': 'Sheppard Square Child Care',
    'location': {'address': '5600 Sheppard Ave E',
     'lat': 43.794412,
     'lng': -79.236126,
     'labeledLatLngs': [{'label': 'display',
       'lat': 43.794412,
       'lng': -79.236126}],
     'distance': 62,
     'postalCode': 'M1B 2L4',
     'cc': 'CA',
     'city': 'Scarborough',
     'state': 'ON',
     'country': 'Canada',
     'formattedAddress': ['5600 Sheppard Ave E',
      'Scarborough ON M1B 2L4',
      'Canada']},
    'categories': [{'id': '4f4532974b9074f6e4fb0104',
      'name': 'Daycare',
      'pluralName': 'Daycares',
      'shortName': 'Daycare',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/daycare_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1555242927',
    'hasPerk': False},
   {'id': '4d937f857ac3a35d2958d825',
    'name': 'Centennial College Child Care Centre',
    'location': {'lat': 43.786091,
     'lng': -79.225181,
     'labeledLatLngs': [{'label': 'display',
       'lat': 43.786091,
       'lng': -79.225181}],
     'distance': 1335,
     'cc': 'CA',
     'country': 'Canada',
     'formattedAddress': ['Canada']},
    'categories': [{'id': '4bf58dd8d48988d198941735',
      'name': 'College Academic Building',
      'pluralName': 'College Academic Buildings',
      'shortName': 'Academic Building',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/education/academicbuilding_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1555242927',
    'hasPerk': False},
   {'id': '5841b68aaf5c144c4edaffa9',
    'name': 'Precious Gems Christian Home Child Care',
    'location': {'address': '96 Dunsfold Dr',
     'lat': 43.814607,
     'lng': -79.228787,
     'labeledLatLngs': [{'label': 'display',
       'lat': 43.814607,
       'lng': -79.228787}],
     'distance': 2275,
     'postalCode': 'M1B 1T6',
     'cc': 'CA',
     'city': 'Scarborough',
     'state': 'ON',
     'country': 'Canada',
     'formattedAddress': ['96 Dunsfold Dr',
      'Scarborough ON M1B 1T6',
      'Canada']},
    'categories': [{'id': '4f4532974b9074f6e4fb0104',
      'name': 'Daycare',
      'pluralName': 'Daycares',
      'shortName': 'Daycare',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/daycare_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1555242927',
    'hasPerk': False},
   {'id': '5bc82090cf72a0002cb19198',
    'name': 'Scarborough Morrish YMCA Child Care Centre',
    'location': {'address': '61 Canmore Blvd',
     'lat': 43.79792960255199,
     'lng': -79.26281207786815,
     'labeledLatLngs': [{'label': 'display',
       'lat': 43.79792960255199,
       'lng': -79.26281207786815}],
     'distance': 2145,
     'postalCode': 'M1C 4B2',
     'cc': 'CA',
     'city': 'Scarborough',
     'state': 'ON',
     'country': 'Canada',
     'formattedAddress': ['61 Canmore Blvd',
      'Scarborough ON M1C 4B2',
      'Canada']},
    'categories': [{'id': '4f4532974b9074f6e4fb0104',
      'name': 'Daycare',
      'pluralName': 'Daycares',
      'shortName': 'Daycare',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/daycare_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1555242927',
    'hasPerk': False},
   {'id': '5bc71981d807ee002ce1ecc6',
    'name': 'Scarborough CD Farquharson YMCA Child Care Centre',
    'location': {'address': '1965 Brimley Road',
     'lat': 43.78459599857809,
     'lng': -79.26616430282593,
     'labeledLatLngs': [{'label': 'display',
       'lat': 43.78459599857809,
       'lng': -79.26616430282593}],
     'distance': 2651,
     'postalCode': 'M1S 2B1',
     'cc': 'CA',
     'city': 'Scarborough',
     'state': 'ON',
     'country': 'Canada',
     'formattedAddress': ['1965 Brimley Road',
      'Scarborough ON M1S 2B1',
      'Canada']},
    'categories': [{'id': '4f4532974b9074f6e4fb0104',
      'name': 'Daycare',
      'pluralName': 'Daycares',
      'shortName': 'Daycare',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/daycare_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1555242927',
    'hasPerk': False},
   {'id': '5bfd072b2b9844002c184de3',
    'name': 'Toronto Scarborough Town Centre Ct YMCA Child Care Centre',
    'location': {'address': '230 Town Center Court',
     'lat': 43.774795235650785,
     'lng': -79.25438404083252,
     'labeledLatLngs': [{'label': 'display',
       'lat': 43.774795235650785,
       'lng': -79.25438404083252}],
     'distance': 2665,
     'postalCode': 'M1P 4Y7',
     'cc': 'CA',
     'city': 'Scarborough',
     'state': 'ON',
     'country': 'Canada',
     'formattedAddress': ['230 Town Center Court',
      'Scarborough ON M1P 4Y7',
      'Canada']},
    'categories': [{'id': '5744ccdfe4b0c0459246b4c7',
      'name': 'Child Care Service',
      'pluralName': 'Child Care Services',
      'shortName': 'Child Care',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/daycare_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1555242927',
    'hasPerk': False}]}}

Get relevant part of JSON and transform it into a pandas dataframe

In [92]:
# assign relevant part of JSON to venues
venues = results['response']['venues']

# tranform venues into a dataframe
dataframe = json_normalize(venues)
dataframe.head()
Out[92]:
categories hasPerk id location.address location.cc location.city location.country location.distance location.formattedAddress location.labeledLatLngs location.lat location.lng location.postalCode location.state name referralId
0 [{'id': '4f4532974b9074f6e4fb0104', 'name': 'D... False 57c8d67bcd1043c5b04493dc 5600 Sheppard Ave E CA Scarborough Canada 62 [5600 Sheppard Ave E, Scarborough ON M1B 2L4, ... [{'label': 'display', 'lat': 43.794412, 'lng':... 43.794412 -79.236126 M1B 2L4 ON Sheppard Square Child Care v-1555242927
1 [{'id': '4bf58dd8d48988d198941735', 'name': 'C... False 4d937f857ac3a35d2958d825 NaN CA NaN Canada 1335 [Canada] [{'label': 'display', 'lat': 43.786091, 'lng':... 43.786091 -79.225181 NaN NaN Centennial College Child Care Centre v-1555242927
2 [{'id': '4f4532974b9074f6e4fb0104', 'name': 'D... False 5841b68aaf5c144c4edaffa9 96 Dunsfold Dr CA Scarborough Canada 2275 [96 Dunsfold Dr, Scarborough ON M1B 1T6, Canada] [{'label': 'display', 'lat': 43.814607, 'lng':... 43.814607 -79.228787 M1B 1T6 ON Precious Gems Christian Home Child Care v-1555242927
3 [{'id': '4f4532974b9074f6e4fb0104', 'name': 'D... False 5bc82090cf72a0002cb19198 61 Canmore Blvd CA Scarborough Canada 2145 [61 Canmore Blvd, Scarborough ON M1C 4B2, Canada] [{'label': 'display', 'lat': 43.79792960255199... 43.797930 -79.262812 M1C 4B2 ON Scarborough Morrish YMCA Child Care Centre v-1555242927
4 [{'id': '4f4532974b9074f6e4fb0104', 'name': 'D... False 5bc71981d807ee002ce1ecc6 1965 Brimley Road CA Scarborough Canada 2651 [1965 Brimley Road, Scarborough ON M1S 2B1, Ca... [{'label': 'display', 'lat': 43.78459599857809... 43.784596 -79.266164 M1S 2B1 ON Scarborough CD Farquharson YMCA Child Care Centre v-1555242927

Define information of interest and filter dataframe

In [94]:
# keep only columns that include venue name, and anything that is associated with location
filtered_columns = ['name', 'categories'] + [col for col in dataframe.columns if col.startswith('location.')] + ['id']
dataframe_filtered = dataframe.loc[:, filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
dataframe_filtered['categories'] = dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
dataframe_filtered.columns = [column.split('.')[-1] for column in dataframe_filtered.columns]

dataframe_filtered
Out[94]:
name categories address cc city country distance formattedAddress labeledLatLngs lat lng postalCode state id
0 Sheppard Square Child Care Daycare 5600 Sheppard Ave E CA Scarborough Canada 62 [5600 Sheppard Ave E, Scarborough ON M1B 2L4, ... [{'label': 'display', 'lat': 43.794412, 'lng':... 43.794412 -79.236126 M1B 2L4 ON 57c8d67bcd1043c5b04493dc
1 Centennial College Child Care Centre College Academic Building NaN CA NaN Canada 1335 [Canada] [{'label': 'display', 'lat': 43.786091, 'lng':... 43.786091 -79.225181 NaN NaN 4d937f857ac3a35d2958d825
2 Precious Gems Christian Home Child Care Daycare 96 Dunsfold Dr CA Scarborough Canada 2275 [96 Dunsfold Dr, Scarborough ON M1B 1T6, Canada] [{'label': 'display', 'lat': 43.814607, 'lng':... 43.814607 -79.228787 M1B 1T6 ON 5841b68aaf5c144c4edaffa9
3 Scarborough Morrish YMCA Child Care Centre Daycare 61 Canmore Blvd CA Scarborough Canada 2145 [61 Canmore Blvd, Scarborough ON M1C 4B2, Canada] [{'label': 'display', 'lat': 43.79792960255199... 43.797930 -79.262812 M1C 4B2 ON 5bc82090cf72a0002cb19198
4 Scarborough CD Farquharson YMCA Child Care Centre Daycare 1965 Brimley Road CA Scarborough Canada 2651 [1965 Brimley Road, Scarborough ON M1S 2B1, Ca... [{'label': 'display', 'lat': 43.78459599857809... 43.784596 -79.266164 M1S 2B1 ON 5bc71981d807ee002ce1ecc6
5 Toronto Scarborough Town Centre Ct YMCA Child ... Child Care Service 230 Town Center Court CA Scarborough Canada 2665 [230 Town Center Court, Scarborough ON M1P 4Y7... [{'label': 'display', 'lat': 43.77479523565078... 43.774795 -79.254384 M1P 4Y7 ON 5bfd072b2b9844002c184de3

Let's visualize child care centers that are nearby

In [95]:
dataframe_filtered.name
Out[95]:
0                           Sheppard Square Child Care
1                 Centennial College Child Care Centre
2              Precious Gems Christian Home Child Care
3           Scarborough Morrish YMCA Child Care Centre
4    Scarborough CD Farquharson YMCA Child Care Centre
5    Toronto Scarborough Town Centre Ct YMCA Child ...
Name: name, dtype: object
In [96]:
center_map = folium.Map(location=[latitude, longitude], zoom_start=13) # generate map centred around your location

# add a red circle marker to represent your location
folium.features.CircleMarker(
    [latitude, longitude],
    radius=10,
    color='red',
    popup= address,
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(center_map)

# add child care centers  as blue circle markers
for lat, lng, label in zip(dataframe_filtered.lat, dataframe_filtered.lng, dataframe_filtered.categories):
    folium.features.CircleMarker(
        [lat, lng],
        radius=5,
        color='blue',
        popup=label,
        fill = True,
        fill_color='blue',
        fill_opacity=0.6
    ).add_to(center_map)

# display map
center_map
Out[96]:

Now you can explore each child center around your address.

In [97]:
venue_id = '5841b68aaf5c144c4edaffa9' # ID of Harry's Italian Pizza Bar
url = 'https://api.foursquare.com/v2/venues/{}?client_id={}&client_secret={}&v={}'.format(venue_id, CLIENT_ID, CLIENT_SECRET, VERSION)
url
Out[97]:
'https://api.foursquare.com/v2/venues/5841b68aaf5c144c4edaffa9?client_id=LA4BGJCCVELUQ02LD33A0JONKW0GBN5TYC4PDW0JXYUN5OMO&client_secret=VZZEJ0RJMXENI2VG0HFQP13XFTR3U4MITOAA0MMH4TZG0LV5&v=20180605'
In [98]:
result = requests.get(url).json()
print(result['response']['venue'].keys())
result['response']['venue']
dict_keys(['id', 'name', 'contact', 'location', 'canonicalUrl', 'categories', 'verified', 'stats', 'url', 'likes', 'dislike', 'ok', 'venueRatingBlacklisted', 'allowMenuUrlEdit', 'beenHere', 'specials', 'photos', 'reasons', 'description', 'hereNow', 'createdAt', 'tips', 'shortUrl', 'timeZone', 'listed', 'hours', 'pageUpdates', 'inbox', 'attributes', 'bestPhoto'])
Out[98]:
{'id': '5841b68aaf5c144c4edaffa9',
 'name': 'Precious Gems Christian Home Child Care',
 'contact': {'phone': '4163350469', 'formattedPhone': '(416) 335-0469'},
 'location': {'address': '96 Dunsfold Dr',
  'lat': 43.814607,
  'lng': -79.228787,
  'labeledLatLngs': [{'label': 'display',
    'lat': 43.814607,
    'lng': -79.228787}],
  'postalCode': 'M1B 1T6',
  'cc': 'CA',
  'city': 'Scarborough',
  'state': 'ON',
  'country': 'Canada',
  'formattedAddress': ['96 Dunsfold Dr', 'Scarborough ON M1B 1T6', 'Canada']},
 'canonicalUrl': 'https://foursquare.com/v/precious-gems-christian-home-child-care/5841b68aaf5c144c4edaffa9',
 'categories': [{'id': '4f4532974b9074f6e4fb0104',
   'name': 'Daycare',
   'pluralName': 'Daycares',
   'shortName': 'Daycare',
   'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/daycare_',
    'suffix': '.png'},
   'primary': True}],
 'verified': False,
 'stats': {'tipCount': 0},
 'url': 'http://www.preciousgemschristiandaycare.com',
 'likes': {'count': 0, 'groups': []},
 'dislike': False,
 'ok': False,
 'venueRatingBlacklisted': True,
 'allowMenuUrlEdit': True,
 'beenHere': {'count': 0,
  'unconfirmedCount': 0,
  'marked': False,
  'lastCheckinExpiredAt': 0},
 'specials': {'count': 0, 'items': []},
 'photos': {'count': 20,
  'groups': [{'type': 'checkin',
    'name': "Friends' check-in photos",
    'count': 0,
    'items': []},
   {'type': 'venue',
    'name': 'Venue photos',
    'count': 20,
    'items': [{'id': '59b6ff73029a552f8558b07b',
      'createdAt': 1505165171,
      'source': {'name': 'Yext Yext', 'url': 'http://yext.com'},
      'prefix': 'https://fastly.4sqi.net/img/general/',
      'suffix': '/87388367_IPX4JZLB_T_nHMtWX3w6ZkqkSB9p4PCM2vcG592T7b0.jpg',
      'width': 800,
      'height': 589,
      'user': {'id': '87388367',
       'firstName': 'Yext',
       'lastName': 'Yext',
       'gender': 'none',
       'photo': {'prefix': 'https://fastly.4sqi.net/img/user/',
        'suffix': '/blank_boy.png',
        'default': True}},
      'visibility': 'public'},
     {'id': '59b6ff72ee71203bd8339ecd',
      'createdAt': 1505165170,
      'source': {'name': 'Yext Yext', 'url': 'http://yext.com'},
      'prefix': 'https://fastly.4sqi.net/img/general/',
      'suffix': '/87388367_Cpssd7_IkOBgW3FpVRaqGX-ObgRryEIWF8OkSiRUxpY.jpg',
      'width': 619,
      'height': 413,
      'user': {'id': '87388367',
       'firstName': 'Yext',
       'lastName': 'Yext',
       'gender': 'none',
       'photo': {'prefix': 'https://fastly.4sqi.net/img/user/',
        'suffix': '/blank_boy.png',
        'default': True}},
      'visibility': 'public'}]}],
  'summary': '0 photos'},
 'reasons': {'count': 0, 'items': []},
 'description': 'Precious Gems Christian Home Daycare is a fun filled learning and Godly environment! We offer programs for children ages 10 months to 7 years at our facility in Scarborough.',
 'hereNow': {'count': 0, 'summary': 'Nobody here', 'groups': []},
 'createdAt': 1480701578,
 'tips': {'count': 0,
  'groups': [{'type': 'others', 'name': 'All tips', 'count': 0, 'items': []}]},
 'shortUrl': 'http://4sq.com/2gVrDau',
 'timeZone': 'America/Toronto',
 'listed': {'count': 0,
  'groups': [{'type': 'others',
    'name': 'Lists from other people',
    'count': 0,
    'items': []}]},
 'hours': {'status': 'Closed until 7:30 AM tomorrow',
  'richStatus': {'entities': [], 'text': 'Closed until 7:30 AM tomorrow'},
  'isOpen': False,
  'isLocalHoliday': False,
  'dayData': [],
  'timeframes': [{'days': 'Mon–Fri',
    'open': [{'renderedTime': '7:30 AM–6:00 PM'}],
    'segments': []}]},
 'pageUpdates': {'count': 0, 'items': []},
 'inbox': {'count': 0, 'items': []},
 'attributes': {'groups': []},
 'bestPhoto': {'id': '59b6ff73029a552f8558b07b',
  'createdAt': 1505165171,
  'source': {'name': 'Yext Yext', 'url': 'http://yext.com'},
  'prefix': 'https://fastly.4sqi.net/img/general/',
  'suffix': '/87388367_IPX4JZLB_T_nHMtWX3w6ZkqkSB9p4PCM2vcG592T7b0.jpg',
  'width': 800,
  'height': 589,
  'visibility': 'public'}}
In [99]:
try:
    print(result['response']['venue']['rating'])
except:
    print('This venue has not been rated yet.')
This venue has not been rated yet.
In [ ]:
 

6. Results and Discussion

This section provides some insights on how the effectiveness of the fee subsidy program is related to the number of child care centres across districts and centre types. First, I aim to visualize the aspects of child care centres for the City of Toronto. I use bar charts to visualize the data.

From the bar chart, we see that the dataset can be briefly analyzed as the following:

  • This report analyzes 1007 child care centres in Toronto as follows:
    • Based on center type we have the following;
      • 668 centers are Non-Profit. (530 have Fee-Subsidy)
      • 286 centers are Commercial. (Only 94 have Fee-Subsidy)
      • 53 centers are city operated. (All have Fee-Subsidy)
    • Based on Fee-Subsidy program we have:
      • 677 centers are accepting Fee-subsidy.
      • 330 centers are not having Fee-subsidy program.
    • Based on center Location:
      • 318 centers are located in Toronto East York.
      • 266 centers are located in North York.
      • 226 centers are located in Etobicoke York.
      • 197 cenetrs are located in Scarborough.
    • Total number of enrolled children in this report is = 68763 ranged from Infant-Toddler-Preschooler-Kindergarten-Gradelevel
    • Childern are distributed based on the type of the care centers as follows:
      • 48871 (71% from total children) are enrolled in Non-Profit centers.
      • 17230 (25% from total children) are enrolled in Commercial centers.
      • 2662 (4% from total children) are enrolled in city-operated centers.

clustering was applied to the data set based on the above categories. 5 clusters labels were in the range [0,1,2,3,4] as follows:

  • 0: color = Red, commercial centers with fee-subsidy.
  • 1: color = Purple, Non-Profit centers with fee-subsidy.
  • 2: color = Blue, commercial centers with no fee-subsidy.
  • 3: color = Green, Non-Profit centers with no fee-subsidy.
  • 4: color = Yellow, City operated centers with fee-subsidy.

7. Conclusion

Investigating the effectiveness of fee subsidy program is multidimensional. It is related to the data on the details of fee subsidy applications in the City of Toronto as well as the fee subsidy policy of child care centres and how many spaces are reserved for children with fee subsidy in these centres. Furthermore, Census 2016 can be used to uncover some demographic features in each district and their wards. This may help us to see which wards need more child care centres with fee subsidy contract.